brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 199ca02 Raw
49 lines · plain
1; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 -verify-dom-info -verify-loop-info \2; RUN:     -S -pass-remarks=loop-interchange 2>&1 | FileCheck %s3 4@A10 = local_unnamed_addr global [3 x [3 x i32]] zeroinitializer, align 165 6;; Test to make sure we can handle zext instructions introduced by7;; IndVarSimplify.8;;9;;  for (int i = 0; i < 2; ++i)10;;    for(int j = 0; j < n; ++j) {11;;      A[j][i] = i;12;;    }13 14; CHECK: Loop interchanged with enclosing loop.15 16@A11 = local_unnamed_addr global [3 x [3 x i32]] zeroinitializer, align 1617 18define void @interchange_11(i32 %n) {19entry:20  br label %for.cond1.preheader21 22for.cond.loopexit:                                ; preds = %for.body423  %exitcond28 = icmp ne i64 %indvars.iv.next27, 224  br i1 %exitcond28, label %for.cond1.preheader, label %for.cond.cleanup25 26for.cond1.preheader:                              ; preds = %for.cond.loopexit, %entry27  %indvars.iv26 = phi i64 [ 0, %entry ], [ %indvars.iv.next27, %for.cond.loopexit ]28  %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 129  br label %for.body430 31for.cond.cleanup:                                 ; preds = %for.cond.loopexit32  ret void33 34for.body4:                                        ; preds = %for.body4, %for.cond1.preheader35  %indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.body4 ]36; The store below does not appear in the C snippet above.37; With two stores in the loop there may be WAW dependences, and interchange is illegal.38;  %arrayidx6 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv2639;  %tmp = trunc i64 %indvars.iv26 to i3240;  store i32 %tmp, i32* %arrayidx6, align 441  %arrayidx10 = getelementptr inbounds [3 x [3 x i32]], ptr @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv.next2742  %tmp1 = trunc i64 %indvars.iv to i3243  store i32 %tmp1, ptr %arrayidx10, align 444  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 145  %n.wide = zext i32 %n to i6446  %exitcond = icmp ne i64 %indvars.iv.next, %n.wide47  br i1 %exitcond, label %for.body4, label %for.cond.loopexit48}49