|
| 1 | +; REQUIRES: asserts |
| 2 | +; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 -verify-dom-info -verify-loop-info \ |
| 3 | +; RUN: -S -debug 2>&1 | FileCheck %s |
| 4 | + |
| 5 | +@aa = global [256 x [256 x float]] zeroinitializer, align 64 |
| 6 | +@bb = global [256 x [256 x float]] zeroinitializer, align 64 |
| 7 | + |
| 8 | +;; for (int nl = 0; nl < 10000000/256; nl++) |
| 9 | +;; for (int i = 0; i < 256; ++i) |
| 10 | +;; for (int j = 1; j < 256; j++) |
| 11 | +;; aa[j][i] = aa[j - 1][i] + bb[j][i]; |
| 12 | + |
| 13 | +; CHECK: Processing InnerLoopId = 2 and OuterLoopId = 1 |
| 14 | +; CHECK: Not interchanging loops. Cannot prove legality. |
| 15 | + |
| 16 | +define float @s231() { |
| 17 | +entry: |
| 18 | + br label %for.cond1.preheader |
| 19 | + |
| 20 | +; Loop: |
| 21 | +for.cond1.preheader: ; preds = %entry, %for.cond.cleanup3 |
| 22 | + %nl.036 = phi i32 [ 0, %entry ], [ %inc23, %for.cond.cleanup3 ] |
| 23 | + br label %for.cond5.preheader |
| 24 | + |
| 25 | +for.cond.cleanup3: ; preds = %for.cond.cleanup7 |
| 26 | + %inc23 = add nuw nsw i32 %nl.036, 1 |
| 27 | + %exitcond41 = icmp ne i32 %inc23, 39062 |
| 28 | + br i1 %exitcond41, label %for.cond1.preheader, label %for.cond.cleanup |
| 29 | + |
| 30 | +for.cond.cleanup7: ; preds = %for.body8 |
| 31 | + %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1 |
| 32 | + %exitcond40 = icmp ne i64 %indvars.iv.next39, 256 |
| 33 | + br i1 %exitcond40, label %for.cond5.preheader, label %for.cond.cleanup3 |
| 34 | + |
| 35 | +for.body8: ; preds = %for.cond5.preheader, %for.body8 |
| 36 | + %indvars.iv = phi i64 [ 1, %for.cond5.preheader ], [ %indvars.iv.next, %for.body8 ] |
| 37 | + %0 = add nsw i64 %indvars.iv, -1 |
| 38 | + %arrayidx10 = getelementptr inbounds [256 x [256 x float]], ptr @aa, i64 0, i64 %0, i64 %indvars.iv38 |
| 39 | + %1 = load float, ptr %arrayidx10, align 4 |
| 40 | + %arrayidx14 = getelementptr inbounds [256 x [256 x float]], ptr @bb, i64 0, i64 %indvars.iv, i64 %indvars.iv38 |
| 41 | + %2 = load float, ptr %arrayidx14, align 4 |
| 42 | + %add = fadd fast float %2, %1 |
| 43 | + %arrayidx18 = getelementptr inbounds [256 x [256 x float]], ptr @aa, i64 0, i64 %indvars.iv, i64 %indvars.iv38 |
| 44 | + store float %add, ptr %arrayidx18, align 4 |
| 45 | + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 46 | + %exitcond = icmp ne i64 %indvars.iv.next, 256 |
| 47 | + br i1 %exitcond, label %for.body8, label %for.cond.cleanup7 |
| 48 | + |
| 49 | +for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond.cleanup7 |
| 50 | + %indvars.iv38 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next39, %for.cond.cleanup7 ] |
| 51 | + br label %for.body8 |
| 52 | + |
| 53 | +; Exit blocks |
| 54 | +for.cond.cleanup: ; preds = %for.cond.cleanup3 |
| 55 | + ret float undef |
| 56 | +} |
0 commit comments