97 lines · plain
1; Remove 'S' Scalar Dependencies #1193452; Scalar dependencies are not handled correctly, so they were removed to avoid3; miscompiles. The loop nest in this test case used to be interchanged, but it's4; no longer triggering. XFAIL'ing this test to indicate that this test should5; interchanged if scalar deps are handled correctly.6;7; XFAIL: *8 9; RUN: opt -passes=loop-interchange -cache-line-size=64 -verify-loop-lcssa %s -pass-remarks-output=%t -disable-output10; RUN: FileCheck -input-file %t %s11 12; Tests for PR43797.13 14@wdtdr = external dso_local global [5 x [5 x double]], align 1615 16; CHECK: --- !Passed17; CHECK-NEXT: Pass: loop-interchange18; CHECK-NEXT: Name: Interchanged19; CHECK-NEXT: Function: test120; CHECK-NEXT: Args:21; CHECK-NEXT: - String: Loop interchanged with enclosing loop.22; CHECK-NEXT: ...23 24define void @test1() {25entry:26 br label %outer.header27 28outer.header: ; preds = %for.inc27, %entry29 %outer.idx = phi i64 [ 0, %entry ], [ %outer.idx.inc, %outer.latch ]30 %arrayidx8 = getelementptr inbounds [5 x [5 x double]], ptr @wdtdr, i64 0, i64 0, i64 %outer.idx31 br label %inner.header32 33inner.header: ; preds = %for.inc, %for.body34 %inner.idx = phi i64 [ 0, %outer.header ], [ %inner.idx.inc, %inner.latch]35 %0 = load double, ptr %arrayidx8, align 836 store double undef, ptr %arrayidx8, align 837 br label %inner.latch38 39inner.latch: ; preds = %for.body640 %inner.idx.inc = add nsw i64 %inner.idx, 141 br i1 false, label %inner.header, label %inner.exit42 43inner.exit: ; preds = %for.inc44 %outer.v = add nsw i64 %outer.idx, 145 br label %outer.latch46 47outer.latch: ; preds = %for.end48 %outer.idx.inc = add nsw i64 %outer.idx, 149 br i1 false, label %outer.header, label %outer.exit50 51outer.exit: ; preds = %for.inc2752 %exit1.lcssa = phi i64 [ %outer.v, %outer.latch ]53 %exit2.lcssa = phi i64 [ %outer.idx.inc, %outer.latch ]54 ret void55}56 57; CHECK: --- !Passed58; CHECK-NEXT: Pass: loop-interchange59; CHECK-NEXT: Name: Interchanged60; CHECK-NEXT: Function: test261; CHECK-NEXT: Args:62; CHECK-NEXT: - String: Loop interchanged with enclosing loop.63; CHECK-NEXT: ...64 65define void @test2(i1 %cond) {66entry:67 br i1 %cond, label %outer.header, label %outer.exit68 69outer.header: ; preds = %for.inc27, %entry70 %outer.idx = phi i64 [ 0, %entry ], [ %outer.idx.inc, %outer.latch ]71 %arrayidx8 = getelementptr inbounds [5 x [5 x double]], ptr @wdtdr, i64 0, i64 0, i64 %outer.idx72 br label %inner.header73 74inner.header: ; preds = %for.inc, %for.body75 %inner.idx = phi i64 [ 0, %outer.header ], [ %inner.idx.inc, %inner.latch]76 %0 = load double, ptr %arrayidx8, align 877 store double undef, ptr %arrayidx8, align 878 br label %inner.latch79 80inner.latch: ; preds = %for.body681 %inner.idx.inc = add nsw i64 %inner.idx , 182 br i1 false, label %inner.header, label %inner.exit83 84inner.exit: ; preds = %for.inc85 %outer.v = add nsw i64 %outer.idx, 186 br label %outer.latch87 88outer.latch: ; preds = %for.end89 %outer.idx.inc = add nsw i64 %outer.idx, 190 br i1 false, label %outer.header, label %outer.exit91 92outer.exit: ; preds = %for.inc2793 %exit1.lcssa = phi i64 [ 0, %entry ], [ %outer.v, %outer.latch ]94 %exit2.lcssa = phi i64 [ 0, %entry ], [ %outer.idx.inc, %outer.latch ]95 ret void96}97