diff options
Diffstat (limited to 'test/Analysis/ScalarEvolution')
46 files changed, 485 insertions, 220 deletions
diff --git a/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll b/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll index b5eb9fc..7380da3 100644 --- a/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll +++ b/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll @@ -11,7 +11,7 @@ entry: bb: ; preds = %bb, %entry %i.01.0 = phi i32 [ 100, %entry ], [ %tmp4, %bb ] ; <i32> [#uses=2] - %tmp1 = getelementptr [101 x i32]* @array, i32 0, i32 %i.01.0 ; <i32*> [#uses=1] + %tmp1 = getelementptr [101 x i32], [101 x i32]* @array, i32 0, i32 %i.01.0 ; <i32*> [#uses=1] store i32 %x, i32* %tmp1 %tmp4 = add i32 %i.01.0, -1 ; <i32> [#uses=2] %tmp7 = icmp sgt i32 %tmp4, -1 ; <i1> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll b/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll index dcf8fc9..7e42530 100644 --- a/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll +++ b/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll @@ -16,11 +16,11 @@ bb.nph: ; preds = %entry bb: ; preds = %bb1, %bb.nph %j.01 = phi i32 [ %8, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=1] - load i32* %srcptr, align 4 ; <i32>:1 [#uses=2] + load i32, i32* %srcptr, align 4 ; <i32>:1 [#uses=2] and i32 %1, 255 ; <i32>:2 [#uses=1] and i32 %1, -256 ; <i32>:3 [#uses=1] - getelementptr [256 x i8]* @lut, i32 0, i32 %2 ; <i8*>:4 [#uses=1] - load i8* %4, align 1 ; <i8>:5 [#uses=1] + getelementptr [256 x i8], [256 x i8]* @lut, i32 0, i32 %2 ; <i8*>:4 [#uses=1] + load i8, i8* %4, align 1 ; <i8>:5 [#uses=1] zext i8 %5 to i32 ; <i32>:6 [#uses=1] or i32 %6, %3 ; <i32>:7 [#uses=1] store i32 %7, i32* %dstptr, align 4 diff --git a/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll b/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll index 7a7a640..0c24ee4 100644 --- a/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll +++ b/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll @@ -9,9 +9,9 @@ bb1.thread: bb1: ; preds = %bb1, %bb1.thread %indvar = phi i32 [ 0, %bb1.thread ], [ %indvar.next, %bb1 ] ; <i32> [#uses=4] %i.0.reg2mem.0 = sub i32 255, %indvar ; <i32> [#uses=2] - %0 = getelementptr i32* %alp, i32 %i.0.reg2mem.0 ; <i32*> [#uses=1] - %1 = load i32* %0, align 4 ; <i32> [#uses=1] - %2 = getelementptr i32* %lam, i32 %i.0.reg2mem.0 ; <i32*> [#uses=1] + %0 = getelementptr i32, i32* %alp, i32 %i.0.reg2mem.0 ; <i32*> [#uses=1] + %1 = load i32, i32* %0, align 4 ; <i32> [#uses=1] + %2 = getelementptr i32, i32* %lam, i32 %i.0.reg2mem.0 ; <i32*> [#uses=1] store i32 %1, i32* %2, align 4 %3 = sub i32 254, %indvar ; <i32> [#uses=1] %4 = icmp slt i32 %3, 0 ; <i1> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll b/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll index f19d18c..ebcecbf 100644 --- a/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll +++ b/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll @@ -9,12 +9,12 @@ define void @func_15() nounwind { entry: - %0 = load i16* @g_16, align 2 ; <i16> [#uses=1] + %0 = load i16, i16* @g_16, align 2 ; <i16> [#uses=1] %1 = icmp sgt i16 %0, 0 ; <i1> [#uses=1] br i1 %1, label %bb2, label %bb.nph bb.nph: ; preds = %entry - %g_16.promoted = load i16* @g_16 ; <i16> [#uses=1] + %g_16.promoted = load i16, i16* @g_16 ; <i16> [#uses=1] br label %bb bb: ; preds = %bb1, %bb.nph diff --git a/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll b/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll index 5d1502d..4f6b90b 100644 --- a/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll +++ b/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll @@ -11,18 +11,18 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1 define void @_Z3foov() nounwind { entry: %x = alloca %struct.NonPod, align 8 ; <%struct.NonPod*> [#uses=2] - %0 = getelementptr %struct.NonPod* %x, i32 0, i32 0 ; <[2 x %struct.Foo]*> [#uses=1] - %1 = getelementptr [2 x %struct.Foo]* %0, i32 1, i32 0 ; <%struct.Foo*> [#uses=1] + %0 = getelementptr %struct.NonPod, %struct.NonPod* %x, i32 0, i32 0 ; <[2 x %struct.Foo]*> [#uses=1] + %1 = getelementptr [2 x %struct.Foo], [2 x %struct.Foo]* %0, i32 1, i32 0 ; <%struct.Foo*> [#uses=1] br label %bb1.i bb1.i: ; preds = %bb2.i, %entry %.0.i = phi %struct.Foo* [ %1, %entry ], [ %4, %bb2.i ] ; <%struct.Foo*> [#uses=2] - %2 = getelementptr %struct.NonPod* %x, i32 0, i32 0, i32 0 ; <%struct.Foo*> [#uses=1] + %2 = getelementptr %struct.NonPod, %struct.NonPod* %x, i32 0, i32 0, i32 0 ; <%struct.Foo*> [#uses=1] %3 = icmp eq %struct.Foo* %.0.i, %2 ; <i1> [#uses=1] br i1 %3, label %_ZN6NonPodD1Ev.exit, label %bb2.i bb2.i: ; preds = %bb1.i - %4 = getelementptr %struct.Foo* %.0.i, i32 -1 ; <%struct.Foo*> [#uses=1] + %4 = getelementptr %struct.Foo, %struct.Foo* %.0.i, i32 -1 ; <%struct.Foo*> [#uses=1] br label %bb1.i _ZN6NonPodD1Ev.exit: ; preds = %bb1.i diff --git a/test/Analysis/ScalarEvolution/2009-07-04-GroupConstantsWidthMismatch.ll b/test/Analysis/ScalarEvolution/2009-07-04-GroupConstantsWidthMismatch.ll index a4358aa..d18bdaf 100644 --- a/test/Analysis/ScalarEvolution/2009-07-04-GroupConstantsWidthMismatch.ll +++ b/test/Analysis/ScalarEvolution/2009-07-04-GroupConstantsWidthMismatch.ll @@ -3,11 +3,11 @@ define void @test() { entry: - %0 = load i16* undef, align 1 + %0 = load i16, i16* undef, align 1 %1 = lshr i16 %0, 8 %2 = and i16 %1, 3 %3 = zext i16 %2 to i32 - %4 = load i8* undef, align 1 + %4 = load i8, i8* undef, align 1 %5 = lshr i8 %4, 4 %6 = and i8 %5, 1 %7 = zext i8 %6 to i32 diff --git a/test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll b/test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll index 5746d1c..c4a4c30 100644 --- a/test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll +++ b/test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll @@ -19,20 +19,20 @@ lbl_818: ; preds = %for.end, %entry br label %for.cond for.cond: ; preds = %for.body, %lbl_818 - %0 = load i32* @g_814, align 4 + %0 = load i32, i32* @g_814, align 4 %cmp = icmp sle i32 %0, 0 br i1 %cmp, label %for.body, label %for.end for.body: ; preds = %for.cond %idxprom = sext i32 %0 to i64 - %arrayidx = getelementptr inbounds [0 x i32]* getelementptr inbounds ([1 x [0 x i32]]* @g_244, i32 0, i64 0), i32 0, i64 %idxprom - %1 = load i32* %arrayidx, align 1 + %arrayidx = getelementptr inbounds [0 x i32], [0 x i32]* getelementptr inbounds ([1 x [0 x i32]], [1 x [0 x i32]]* @g_244, i32 0, i64 0), i32 0, i64 %idxprom + %1 = load i32, i32* %arrayidx, align 1 store i32 %1, i32* @func_21_l_773, align 4 store i32 1, i32* @g_814, align 4 br label %for.cond for.end: ; preds = %for.cond - %2 = load i32* @func_21_l_773, align 4 + %2 = load i32, i32* @func_21_l_773, align 4 %tobool = icmp ne i32 %2, 0 br i1 %tobool, label %lbl_818, label %if.end diff --git a/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll b/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll index 2cb8c5b..f7ef0ea 100644 --- a/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll +++ b/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll @@ -10,7 +10,7 @@ entry: br label %bb3 bb: ; preds = %bb3 - %tmp = getelementptr [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1] + %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1] store i32 123, i32* %tmp %tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1] br label %bb3 diff --git a/test/Analysis/ScalarEvolution/avoid-infinite-recursion-0.ll b/test/Analysis/ScalarEvolution/avoid-infinite-recursion-0.ll index 7eeb308..0976ef9 100644 --- a/test/Analysis/ScalarEvolution/avoid-infinite-recursion-0.ll +++ b/test/Analysis/ScalarEvolution/avoid-infinite-recursion-0.ll @@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gnu" define i32 @test() { entry: - %0 = load i32** undef, align 8 ; <i32*> [#uses=1] + %0 = load i32*, i32** undef, align 8 ; <i32*> [#uses=1] %1 = ptrtoint i32* %0 to i64 ; <i64> [#uses=1] %2 = sub i64 undef, %1 ; <i64> [#uses=1] %3 = lshr i64 %2, 3 ; <i64> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/avoid-smax-0.ll b/test/Analysis/ScalarEvolution/avoid-smax-0.ll index 8abb430..a282ee6 100644 --- a/test/Analysis/ScalarEvolution/avoid-smax-0.ll +++ b/test/Analysis/ScalarEvolution/avoid-smax-0.ll @@ -11,7 +11,7 @@ entry: br i1 %0, label %bb, label %return bb: - load i32* %q, align 4 + load i32, i32* %q, align 4 icmp eq i32 %1, 0 br i1 %2, label %return, label %bb3.preheader @@ -20,10 +20,10 @@ bb3.preheader: bb3: %i.0 = phi i32 [ %7, %bb3 ], [ 0, %bb3.preheader ] - getelementptr i32* %p, i32 %i.0 - load i32* %3, align 4 + getelementptr i32, i32* %p, i32 %i.0 + load i32, i32* %3, align 4 add i32 %4, 1 - getelementptr i32* %p, i32 %i.0 + getelementptr i32, i32* %p, i32 %i.0 store i32 %5, i32* %6, align 4 add i32 %i.0, 1 icmp slt i32 %7, %n diff --git a/test/Analysis/ScalarEvolution/avoid-smax-1.ll b/test/Analysis/ScalarEvolution/avoid-smax-1.ll index d9b83a9..e6c62ee 100644 --- a/test/Analysis/ScalarEvolution/avoid-smax-1.ll +++ b/test/Analysis/ScalarEvolution/avoid-smax-1.ll @@ -35,9 +35,9 @@ bb6: ; preds = %bb7, %bb.nph7 %7 = add i32 %x.06, %4 ; <i32> [#uses=1] %8 = shl i32 %x.06, 1 ; <i32> [#uses=1] %9 = add i32 %6, %8 ; <i32> [#uses=1] - %10 = getelementptr i8* %r, i32 %9 ; <i8*> [#uses=1] - %11 = load i8* %10, align 1 ; <i8> [#uses=1] - %12 = getelementptr i8* %j, i32 %7 ; <i8*> [#uses=1] + %10 = getelementptr i8, i8* %r, i32 %9 ; <i8*> [#uses=1] + %11 = load i8, i8* %10, align 1 ; <i8> [#uses=1] + %12 = getelementptr i8, i8* %j, i32 %7 ; <i8*> [#uses=1] store i8 %11, i8* %12, align 1 %13 = add i32 %x.06, 1 ; <i32> [#uses=2] br label %bb7 @@ -102,18 +102,18 @@ bb14: ; preds = %bb15, %bb.nph3 %x.12 = phi i32 [ %40, %bb15 ], [ 0, %bb.nph3 ] ; <i32> [#uses=5] %29 = shl i32 %x.12, 2 ; <i32> [#uses=1] %30 = add i32 %29, %25 ; <i32> [#uses=1] - %31 = getelementptr i8* %r, i32 %30 ; <i8*> [#uses=1] - %32 = load i8* %31, align 1 ; <i8> [#uses=1] + %31 = getelementptr i8, i8* %r, i32 %30 ; <i8*> [#uses=1] + %32 = load i8, i8* %31, align 1 ; <i8> [#uses=1] %.sum = add i32 %26, %x.12 ; <i32> [#uses=1] - %33 = getelementptr i8* %j, i32 %.sum ; <i8*> [#uses=1] + %33 = getelementptr i8, i8* %j, i32 %.sum ; <i8*> [#uses=1] store i8 %32, i8* %33, align 1 %34 = shl i32 %x.12, 2 ; <i32> [#uses=1] %35 = or i32 %34, 2 ; <i32> [#uses=1] %36 = add i32 %35, %25 ; <i32> [#uses=1] - %37 = getelementptr i8* %r, i32 %36 ; <i8*> [#uses=1] - %38 = load i8* %37, align 1 ; <i8> [#uses=1] + %37 = getelementptr i8, i8* %r, i32 %36 ; <i8*> [#uses=1] + %38 = load i8, i8* %37, align 1 ; <i8> [#uses=1] %.sum6 = add i32 %27, %x.12 ; <i32> [#uses=1] - %39 = getelementptr i8* %j, i32 %.sum6 ; <i8*> [#uses=1] + %39 = getelementptr i8, i8* %j, i32 %.sum6 ; <i8*> [#uses=1] store i8 %38, i8* %39, align 1 %40 = add i32 %x.12, 1 ; <i32> [#uses=2] br label %bb15 @@ -168,10 +168,10 @@ bb23: ; preds = %bb24, %bb.nph %y.21 = phi i32 [ %57, %bb24 ], [ 0, %bb.nph ] ; <i32> [#uses=3] %53 = mul i32 %y.21, %50 ; <i32> [#uses=1] %.sum1 = add i32 %53, %51 ; <i32> [#uses=1] - %54 = getelementptr i8* %r, i32 %.sum1 ; <i8*> [#uses=1] + %54 = getelementptr i8, i8* %r, i32 %.sum1 ; <i8*> [#uses=1] %55 = mul i32 %y.21, %w ; <i32> [#uses=1] %.sum5 = add i32 %55, %.sum3 ; <i32> [#uses=1] - %56 = getelementptr i8* %j, i32 %.sum5 ; <i8*> [#uses=1] + %56 = getelementptr i8, i8* %j, i32 %.sum5 ; <i8*> [#uses=1] tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %56, i8* %54, i32 %w, i32 1, i1 false) %57 = add i32 %y.21, 1 ; <i32> [#uses=2] br label %bb24 @@ -186,7 +186,7 @@ bb24.bb26_crit_edge: ; preds = %bb24 bb26: ; preds = %bb24.bb26_crit_edge, %bb22 %59 = mul i32 %x, %w ; <i32> [#uses=1] %.sum4 = add i32 %.sum3, %59 ; <i32> [#uses=1] - %60 = getelementptr i8* %j, i32 %.sum4 ; <i8*> [#uses=1] + %60 = getelementptr i8, i8* %j, i32 %.sum4 ; <i8*> [#uses=1] %61 = mul i32 %x, %w ; <i32> [#uses=1] %62 = sdiv i32 %61, 2 ; <i32> [#uses=1] tail call void @llvm.memset.p0i8.i32(i8* %60, i8 -128, i32 %62, i32 1, i1 false) @@ -204,9 +204,9 @@ bb.nph11: ; preds = %bb29 bb30: ; preds = %bb31, %bb.nph11 %y.310 = phi i32 [ %70, %bb31 ], [ 0, %bb.nph11 ] ; <i32> [#uses=3] %66 = mul i32 %y.310, %64 ; <i32> [#uses=1] - %67 = getelementptr i8* %r, i32 %66 ; <i8*> [#uses=1] + %67 = getelementptr i8, i8* %r, i32 %66 ; <i8*> [#uses=1] %68 = mul i32 %y.310, %w ; <i32> [#uses=1] - %69 = getelementptr i8* %j, i32 %68 ; <i8*> [#uses=1] + %69 = getelementptr i8, i8* %j, i32 %68 ; <i8*> [#uses=1] tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %69, i8* %67, i32 %w, i32 1, i1 false) %70 = add i32 %y.310, 1 ; <i32> [#uses=2] br label %bb31 @@ -220,7 +220,7 @@ bb31.bb33_crit_edge: ; preds = %bb31 bb33: ; preds = %bb31.bb33_crit_edge, %bb29 %72 = mul i32 %x, %w ; <i32> [#uses=1] - %73 = getelementptr i8* %j, i32 %72 ; <i8*> [#uses=1] + %73 = getelementptr i8, i8* %j, i32 %72 ; <i8*> [#uses=1] %74 = mul i32 %x, %w ; <i32> [#uses=1] %75 = sdiv i32 %74, 2 ; <i32> [#uses=1] tail call void @llvm.memset.p0i8.i32(i8* %73, i8 -128, i32 %75, i32 1, i1 false) diff --git a/test/Analysis/ScalarEvolution/ext-antecedent.ll b/test/Analysis/ScalarEvolution/ext-antecedent.ll new file mode 100644 index 0000000..e8d3813 --- /dev/null +++ b/test/Analysis/ScalarEvolution/ext-antecedent.ll @@ -0,0 +1,45 @@ +; RUN: opt -S -indvars < %s | FileCheck %s + +declare void @use(i1) + +define void @sext_condition(i8 %t) { +; CHECK-LABEL: sext_condition + entry: + %st = sext i8 %t to i16 + %ecmp = icmp slt i16 %st, 42 + br i1 %ecmp, label %loop, label %exit + + loop: +; CHECK-LABEL: loop + %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ] + %idx.inc = add i8 %idx, 1 + %c = icmp slt i8 %idx, 42 +; CHECK: call void @use(i1 true) + call void @use(i1 %c) + %be = icmp slt i8 %idx.inc, 42 + br i1 %be, label %loop, label %exit + + exit: + ret void +} + +define void @zext_condition(i8 %t) { +; CHECK-LABEL: zext_condition + entry: + %st = zext i8 %t to i16 + %ecmp = icmp ult i16 %st, 42 + br i1 %ecmp, label %loop, label %exit + + loop: +; CHECK-LABEL: loop + %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ] + %idx.inc = add i8 %idx, 1 + %c = icmp ult i8 %idx, 42 +; CHECK: call void @use(i1 true) + call void @use(i1 %c) + %be = icmp ult i8 %idx.inc, 42 + br i1 %be, label %loop, label %exit + + exit: + ret void +} diff --git a/test/Analysis/ScalarEvolution/fold.ll b/test/Analysis/ScalarEvolution/fold.ll index ab57425..226a24f 100644 --- a/test/Analysis/ScalarEvolution/fold.ll +++ b/test/Analysis/ScalarEvolution/fold.ll @@ -34,7 +34,7 @@ loop: %rand2 = icmp ugt i32 %A, %Z1 %Z2 = select i1 %rand2, i32 %A, i32 %Z1 ; CHECK: %Z2 = -; CHECK-NEXT: --> ([[EXPR:.*]]){{ +}}Exits: 20 +; CHECK-NEXT: --> ([[EXPR:.*]]){{ U: [^ ]+ S: [^ ]+}}{{ +}}Exits: 20 %B = trunc i32 %Z2 to i16 %C = sext i16 %B to i30 ; CHECK: %C = @@ -86,3 +86,15 @@ define void @test6(i8 %x) { ; CHECK: --> (2048 * ((zext i8 %x to i16) /u 8)) ret void } + +; PR22960 +define void @test7(i32 %A) { +; CHECK-LABEL: @test7 + %B = sext i32 %A to i64 + %C = zext i32 %A to i64 + %D = sub i64 %B, %C + %E = trunc i64 %D to i16 +; CHECK: %E +; CHECK-NEXT: --> 0 + ret void +} diff --git a/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll b/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll index c9689f7..078ca03 100644 --- a/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll +++ b/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll @@ -53,7 +53,7 @@ define void @infer.sext.1(i32 %start, i1* %c) { ; CHECK: %idx.sext = sext i32 %idx to i64 ; CHECK-NEXT: --> {(2 + (sext i32 (4 * %start) to i64)),+,2}<nsw><%loop> %idx.inc = add nsw i32 %idx, 2 - %condition = load i1* %c + %condition = load i1, i1* %c br i1 %condition, label %exit, label %loop exit: @@ -73,7 +73,7 @@ define void @infer.sext.2(i1* %c, i8 %start) { ; CHECK: %idx.sext = sext i8 %idx to i16 ; CHECK-NEXT: --> {(1 + (sext i8 %start to i16)),+,1}<nsw><%loop> %idx.inc = add nsw i8 %idx, 1 - %condition = load volatile i1* %c + %condition = load volatile i1, i1* %c br i1 %condition, label %exit, label %loop exit: @@ -93,7 +93,7 @@ define void @infer.zext.1(i1* %c, i8 %start) { ; CHECK: %idx.zext = zext i8 %idx to i16 ; CHECK-NEXT: --> {(1 + (zext i8 %start to i16)),+,1}<nuw><%loop> %idx.inc = add nuw i8 %idx, 1 - %condition = load volatile i1* %c + %condition = load volatile i1, i1* %c br i1 %condition, label %exit, label %loop exit: diff --git a/test/Analysis/ScalarEvolution/infer-via-ranges.ll b/test/Analysis/ScalarEvolution/infer-via-ranges.ll new file mode 100644 index 0000000..3627c3a --- /dev/null +++ b/test/Analysis/ScalarEvolution/infer-via-ranges.ll @@ -0,0 +1,30 @@ +; RUN: opt -indvars -S < %s | FileCheck %s + +define void @infer_via_ranges(i32 *%arr, i32 %n) { +; CHECK-LABEL: @infer_via_ranges + entry: + %first.itr.check = icmp sgt i32 %n, 0 + %start = sub i32 %n, 1 + br i1 %first.itr.check, label %loop, label %exit + + loop: +; CHECK-LABEL: loop: + %idx = phi i32 [ %start, %entry ] , [ %idx.dec, %in.bounds ] + %idx.dec = sub i32 %idx, 1 + %abc = icmp sge i32 %idx, 0 +; CHECK: br i1 true, label %in.bounds, label %out.of.bounds + br i1 %abc, label %in.bounds, label %out.of.bounds + + in.bounds: +; CHECK-LABEL: in.bounds: + %addr = getelementptr i32, i32* %arr, i32 %idx + store i32 0, i32* %addr + %next = icmp sgt i32 %idx.dec, -1 + br i1 %next, label %loop, label %exit + + out.of.bounds: + ret void + + exit: + ret void +} diff --git a/test/Analysis/ScalarEvolution/load-with-range-metadata.ll b/test/Analysis/ScalarEvolution/load-with-range-metadata.ll index 32c1074..f26c8d5 100644 --- a/test/Analysis/ScalarEvolution/load-with-range-metadata.ll +++ b/test/Analysis/ScalarEvolution/load-with-range-metadata.ll @@ -3,7 +3,7 @@ define i32 @slt_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) { ; CHECK-LABEL: slt_trip_count_with_range entry: - %limit = load i32* %ptr0, !range !0 + %limit = load i32, i32* %ptr0, !range !0 br label %loop loop: @@ -20,7 +20,7 @@ define i32 @slt_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) { define i32 @ult_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) { ; CHECK-LABEL: ult_trip_count_with_range entry: - %limit = load i32* %ptr0, !range !0 + %limit = load i32, i32* %ptr0, !range !0 br label %loop loop: diff --git a/test/Analysis/ScalarEvolution/load.ll b/test/Analysis/ScalarEvolution/load.ll index 2c753f5..ea79476 100644 --- a/test/Analysis/ScalarEvolution/load.ll +++ b/test/Analysis/ScalarEvolution/load.ll @@ -14,14 +14,14 @@ entry: for.body: ; preds = %entry, %for.body %sum.04 = phi i32 [ 0, %entry ], [ %add2, %for.body ] -; CHECK: --> %sum.04{{ *}}Exits: 2450 +; CHECK: --> %sum.04{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 2450 %i.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %arrayidx = getelementptr inbounds [50 x i32]* @arr1, i32 0, i32 %i.03 - %0 = load i32* %arrayidx, align 4 -; CHECK: --> %0{{ *}}Exits: 50 - %arrayidx1 = getelementptr inbounds [50 x i32]* @arr2, i32 0, i32 %i.03 - %1 = load i32* %arrayidx1, align 4 -; CHECK: --> %1{{ *}}Exits: 0 + %arrayidx = getelementptr inbounds [50 x i32], [50 x i32]* @arr1, i32 0, i32 %i.03 + %0 = load i32, i32* %arrayidx, align 4 +; CHECK: --> %0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 50 + %arrayidx1 = getelementptr inbounds [50 x i32], [50 x i32]* @arr2, i32 0, i32 %i.03 + %1 = load i32, i32* %arrayidx1, align 4 +; CHECK: --> %1{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 0 %add = add i32 %0, %sum.04 %add2 = add i32 %add, %1 %inc = add nsw i32 %i.03, 1 @@ -48,15 +48,15 @@ entry: for.body: ; preds = %entry, %for.body %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ] -; CHECK: --> %sum.02{{ *}}Exits: 10 +; CHECK: --> %sum.02{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 10 %n.01 = phi %struct.ListNode* [ bitcast ({ %struct.ListNode*, i32, [4 x i8] }* @node5 to %struct.ListNode*), %entry ], [ %1, %for.body ] -; CHECK: --> %n.01{{ *}}Exits: @node1 - %i = getelementptr inbounds %struct.ListNode* %n.01, i64 0, i32 1 - %0 = load i32* %i, align 4 +; CHECK: --> %n.01{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: @node1 + %i = getelementptr inbounds %struct.ListNode, %struct.ListNode* %n.01, i64 0, i32 1 + %0 = load i32, i32* %i, align 4 %add = add nsw i32 %0, %sum.02 - %next = getelementptr inbounds %struct.ListNode* %n.01, i64 0, i32 0 - %1 = load %struct.ListNode** %next, align 8 -; CHECK: --> %1{{ *}}Exits: 0 + %next = getelementptr inbounds %struct.ListNode, %struct.ListNode* %n.01, i64 0, i32 0 + %1 = load %struct.ListNode*, %struct.ListNode** %next, align 8 +; CHECK: --> %1{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 0 %cmp = icmp eq %struct.ListNode* %1, null br i1 %cmp, label %for.end, label %for.body diff --git a/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll b/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll index aa5254c..8d6cb2f 100644 --- a/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll +++ b/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll @@ -4,7 +4,7 @@ target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-p4:64:64:64-n16:32:64" -; CHECK: {%d,+,4}<%bb> Exits: ((4 * (trunc i32 (-1 + %n) to i16)) + %d) +; CHECK: {%d,+,4}<%bb>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: ((4 * (trunc i32 (-1 + %n) to i16)) + %d) define void @foo(i32 addrspace(1)* nocapture %d, i32 %n) nounwind { @@ -21,7 +21,7 @@ bb: ; preds = %bb1, %bb.nph %p.01 = phi i8 [ %4, %bb1 ], [ -1, %bb.nph ] ; <i8> [#uses=2] %1 = sext i8 %p.01 to i32 ; <i32> [#uses=1] %2 = sext i32 %i.02 to i64 ; <i64> [#uses=1] - %3 = getelementptr i32 addrspace(1)* %d, i64 %2 ; <i32*> [#uses=1] + %3 = getelementptr i32, i32 addrspace(1)* %d, i64 %2 ; <i32*> [#uses=1] store i32 %1, i32 addrspace(1)* %3, align 4 %4 = add i8 %p.01, 1 ; <i8> [#uses=1] %5 = add i32 %i.02, 1 ; <i32> [#uses=2] @@ -50,7 +50,7 @@ for.body.lr.ph: ; preds = %entry for.body: ; preds = %for.body, %for.body.lr.ph %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %for.body.lr.ph ] - %arrayidx = getelementptr i8 addrspace(1)* %a, i64 %indvar + %arrayidx = getelementptr i8, i8 addrspace(1)* %a, i64 %indvar store i8 0, i8 addrspace(1)* %arrayidx, align 1 %indvar.next = add i64 %indvar, 1 %exitcond = icmp ne i64 %indvar.next, %tmp diff --git a/test/Analysis/ScalarEvolution/max-trip-count.ll b/test/Analysis/ScalarEvolution/max-trip-count.ll index 31f06a4..72560c7 100644 --- a/test/Analysis/ScalarEvolution/max-trip-count.ll +++ b/test/Analysis/ScalarEvolution/max-trip-count.ll @@ -2,7 +2,7 @@ ; ScalarEvolution should be able to understand the loop and eliminate the casts. -; CHECK: {%d,+,sizeof(i32)} +; CHECK: {%d,+,4} define void @foo(i32* nocapture %d, i32 %n) nounwind { entry: @@ -17,7 +17,7 @@ bb: ; preds = %bb1, %bb.nph %p.01 = phi i8 [ %4, %bb1 ], [ -1, %bb.nph ] ; <i8> [#uses=2] %1 = sext i8 %p.01 to i32 ; <i32> [#uses=1] %2 = sext i32 %i.02 to i64 ; <i64> [#uses=1] - %3 = getelementptr i32* %d, i64 %2 ; <i32*> [#uses=1] + %3 = getelementptr i32, i32* %d, i64 %2 ; <i32*> [#uses=1] store i32 %1, i32* %3, align 4 %4 = add i8 %p.01, 1 ; <i8> [#uses=1] %5 = add i32 %i.02, 1 ; <i32> [#uses=2] @@ -39,7 +39,7 @@ return: ; preds = %bb1.return_crit_edge, %entry ; count, it should say so. ; PR7845 -; CHECK: Loop %for.cond: <multiple exits> Unpredictable backedge-taken count. +; CHECK: Loop %for.cond: <multiple exits> Unpredictable backedge-taken count. ; CHECK: Loop %for.cond: max backedge-taken count is 5 @.str = private constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=2] @@ -65,7 +65,7 @@ for.inc: ; preds = %for.body br label %for.cond for.end: ; preds = %for.body, %for.cond - %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %g_4.0) nounwind ; <i32> [#uses=0] + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %g_4.0) nounwind ; <i32> [#uses=0] ret i32 0 } @@ -82,7 +82,7 @@ for.body.lr.ph: ; preds = %entry for.body: ; preds = %for.body, %for.body.lr.ph %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %for.body.lr.ph ] - %arrayidx = getelementptr i8* %a, i64 %indvar + %arrayidx = getelementptr i8, i8* %a, i64 %indvar store i8 0, i8* %arrayidx, align 1 %indvar.next = add i64 %indvar, 1 %exitcond = icmp ne i64 %indvar.next, %tmp @@ -101,7 +101,7 @@ for.end: ; preds = %for.cond.for.end_cr ; PR19799: Indvars miscompile due to an incorrect max backedge taken count from SCEV. ; CHECK-LABEL: @pr19799 -; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count. +; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count. ; CHECK: Loop %for.body.i: max backedge-taken count is 1 @a = common global i32 0, align 4 @@ -127,7 +127,7 @@ bar.exit: ; preds = %for.cond.i, %for.bo ; PR18886: Indvars miscompile due to an incorrect max backedge taken count from SCEV. ; CHECK-LABEL: @pr18886 -; CHECK: Loop %for.body: <multiple exits> Unpredictable backedge-taken count. +; CHECK: Loop %for.body: <multiple exits> Unpredictable backedge-taken count. ; CHECK: Loop %for.body: max backedge-taken count is 3 @aa = global i64 0, align 8 @@ -157,8 +157,8 @@ return: ; before the check is forever skipped. ; ; CHECK-LABEL: @cannot_compute_mustexit -; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count. -; CHECK: Loop %for.body.i: Unpredictable max backedge-taken count. +; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count. +; CHECK: Loop %for.body.i: Unpredictable max backedge-taken count. @b = common global i32 0, align 4 define i32 @cannot_compute_mustexit() { @@ -174,7 +174,7 @@ for.body.i: ; preds = %for.cond.i, %entry for.cond.i: ; preds = %for.body.i store i32 %add.i.i, i32* @a, align 4 - %ld = load volatile i32* @b + %ld = load volatile i32, i32* @b %cmp.i = icmp ne i32 %ld, 0 br i1 %cmp.i, label %for.body.i, label %bar.exit @@ -186,7 +186,7 @@ bar.exit: ; preds = %for.cond.i, %for.bo ; MaxBECount should be the minimum of them. ; ; CHECK-LABEL: @two_mustexit -; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count. +; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count. ; CHECK: Loop %for.body.i: max backedge-taken count is 1 define i32 @two_mustexit() { entry: diff --git a/test/Analysis/ScalarEvolution/min-max-exprs.ll b/test/Analysis/ScalarEvolution/min-max-exprs.ll index 3e0a35d..892fc23 100644 --- a/test/Analysis/ScalarEvolution/min-max-exprs.ll +++ b/test/Analysis/ScalarEvolution/min-max-exprs.ll @@ -34,8 +34,8 @@ bb2: ; preds = %bb1 ; min(N, i+3) ; CHECK: select i1 %tmp4, i64 %tmp5, i64 %tmp6 ; CHECK-NEXT: --> (-1 + (-1 * ((-1 + (-1 * (sext i32 {3,+,1}<nw><%bb1> to i64))) smax (-1 + (-1 * (sext i32 %N to i64)))))) - %tmp11 = getelementptr inbounds i32* %A, i64 %tmp9 - %tmp12 = load i32* %tmp11, align 4 + %tmp11 = getelementptr inbounds i32, i32* %A, i64 %tmp9 + %tmp12 = load i32, i32* %tmp11, align 4 %tmp13 = shl nsw i32 %tmp12, 1 %tmp14 = icmp sge i32 3, %i.0 %tmp17 = add nsw i64 %i.0.1, -3 @@ -43,7 +43,7 @@ bb2: ; preds = %bb1 ; max(0, i - 3) ; CHECK: select i1 %tmp14, i64 0, i64 %tmp17 ; CHECK-NEXT: --> (-3 + (3 smax {0,+,1}<nuw><nsw><%bb1>)) - %tmp21 = getelementptr inbounds i32* %A, i64 %tmp19 + %tmp21 = getelementptr inbounds i32, i32* %A, i64 %tmp19 store i32 %tmp13, i32* %tmp21, align 4 %tmp23 = add nuw nsw i32 %i.0, 1 br label %bb1 diff --git a/test/Analysis/ScalarEvolution/nowrap-preinc-limits.ll b/test/Analysis/ScalarEvolution/nowrap-preinc-limits.ll new file mode 100644 index 0000000..1a5409d --- /dev/null +++ b/test/Analysis/ScalarEvolution/nowrap-preinc-limits.ll @@ -0,0 +1,44 @@ +; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s + +define void @f(i1* %condition) { +; CHECK-LABEL: Classifying expressions for: @f + entry: + br label %loop + + loop: + %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] + %idx.inc = add nsw i32 %idx, 1 + + %idx.inc2 = add i32 %idx.inc, 1 + %idx.inc2.zext = zext i32 %idx.inc2 to i64 + +; CHECK: %idx.inc2.zext = zext i32 %idx.inc2 to i64 +; CHECK-NEXT: --> {2,+,1}<nuw><%loop> + + %c = load volatile i1, i1* %condition + br i1 %c, label %loop, label %exit + + exit: + ret void +} + +define void @g(i1* %condition) { +; CHECK-LABEL: Classifying expressions for: @g + entry: + br label %loop + + loop: + %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] + %idx.inc = add nsw i32 %idx, 3 + + %idx.inc2 = add i32 %idx.inc, -1 + %idx.inc2.sext = sext i32 %idx.inc2 to i64 +; CHECK: %idx.inc2.sext = sext i32 %idx.inc2 to i64 +; CHECK-NEXT: --> {2,+,3}<nuw><nsw><%loop> + + %c = load volatile i1, i1* %condition + br i1 %c, label %loop, label %exit + + exit: + ret void +} diff --git a/test/Analysis/ScalarEvolution/nsw-offset-assume.ll b/test/Analysis/ScalarEvolution/nsw-offset-assume.ll index 29cf658..bef1070 100644 --- a/test/Analysis/ScalarEvolution/nsw-offset-assume.ll +++ b/test/Analysis/ScalarEvolution/nsw-offset-assume.ll @@ -24,23 +24,23 @@ bb: ; preds = %bb.nph, %bb1 ; CHECK: --> {0,+,2}<nuw><nsw><%bb> %1 = sext i32 %i.01 to i64 ; <i64> [#uses=1] -; CHECK: %2 = getelementptr inbounds double* %d, i64 %1 +; CHECK: %2 = getelementptr inbounds double, double* %d, i64 %1 ; CHECK: --> {%d,+,16}<nsw><%bb> - %2 = getelementptr inbounds double* %d, i64 %1 ; <double*> [#uses=1] + %2 = getelementptr inbounds double, double* %d, i64 %1 ; <double*> [#uses=1] - %3 = load double* %2, align 8 ; <double> [#uses=1] + %3 = load double, double* %2, align 8 ; <double> [#uses=1] %4 = sext i32 %i.01 to i64 ; <i64> [#uses=1] - %5 = getelementptr inbounds double* %q, i64 %4 ; <double*> [#uses=1] - %6 = load double* %5, align 8 ; <double> [#uses=1] + %5 = getelementptr inbounds double, double* %q, i64 %4 ; <double*> [#uses=1] + %6 = load double, double* %5, align 8 ; <double> [#uses=1] %7 = or i32 %i.01, 1 ; <i32> [#uses=1] ; CHECK: %8 = sext i32 %7 to i64 ; CHECK: --> {1,+,2}<nuw><nsw><%bb> %8 = sext i32 %7 to i64 ; <i64> [#uses=1] -; CHECK: %9 = getelementptr inbounds double* %q, i64 %8 +; CHECK: %9 = getelementptr inbounds double, double* %q, i64 %8 ; CHECK: {(8 + %q),+,16}<nsw><%bb> - %9 = getelementptr inbounds double* %q, i64 %8 ; <double*> [#uses=1] + %9 = getelementptr inbounds double, double* %q, i64 %8 ; <double*> [#uses=1] ; Artificially repeat the above three instructions, this time using ; add nsw instead of or. @@ -50,16 +50,16 @@ bb: ; preds = %bb.nph, %bb1 ; CHECK: --> {1,+,2}<nuw><nsw><%bb> %t8 = sext i32 %t7 to i64 ; <i64> [#uses=1] -; CHECK: %t9 = getelementptr inbounds double* %q, i64 %t8 +; CHECK: %t9 = getelementptr inbounds double, double* %q, i64 %t8 ; CHECK: {(8 + %q),+,16}<nsw><%bb> - %t9 = getelementptr inbounds double* %q, i64 %t8 ; <double*> [#uses=1] + %t9 = getelementptr inbounds double, double* %q, i64 %t8 ; <double*> [#uses=1] - %10 = load double* %9, align 8 ; <double> [#uses=1] + %10 = load double, double* %9, align 8 ; <double> [#uses=1] %11 = fadd double %6, %10 ; <double> [#uses=1] %12 = fadd double %11, 3.200000e+00 ; <double> [#uses=1] %13 = fmul double %3, %12 ; <double> [#uses=1] %14 = sext i32 %i.01 to i64 ; <i64> [#uses=1] - %15 = getelementptr inbounds double* %d, i64 %14 ; <double*> [#uses=1] + %15 = getelementptr inbounds double, double* %d, i64 %14 ; <double*> [#uses=1] store double %13, double* %15, align 8 %16 = add nsw i32 %i.01, 2 ; <i32> [#uses=2] br label %bb1 diff --git a/test/Analysis/ScalarEvolution/nsw-offset.ll b/test/Analysis/ScalarEvolution/nsw-offset.ll index 88cdcf2..127bb19 100644 --- a/test/Analysis/ScalarEvolution/nsw-offset.ll +++ b/test/Analysis/ScalarEvolution/nsw-offset.ll @@ -22,23 +22,23 @@ bb: ; preds = %bb.nph, %bb1 ; CHECK: --> {0,+,2}<nuw><nsw><%bb> %1 = sext i32 %i.01 to i64 ; <i64> [#uses=1] -; CHECK: %2 = getelementptr inbounds double* %d, i64 %1 +; CHECK: %2 = getelementptr inbounds double, double* %d, i64 %1 ; CHECK: --> {%d,+,16}<nsw><%bb> - %2 = getelementptr inbounds double* %d, i64 %1 ; <double*> [#uses=1] + %2 = getelementptr inbounds double, double* %d, i64 %1 ; <double*> [#uses=1] - %3 = load double* %2, align 8 ; <double> [#uses=1] + %3 = load double, double* %2, align 8 ; <double> [#uses=1] %4 = sext i32 %i.01 to i64 ; <i64> [#uses=1] - %5 = getelementptr inbounds double* %q, i64 %4 ; <double*> [#uses=1] - %6 = load double* %5, align 8 ; <double> [#uses=1] + %5 = getelementptr inbounds double, double* %q, i64 %4 ; <double*> [#uses=1] + %6 = load double, double* %5, align 8 ; <double> [#uses=1] %7 = or i32 %i.01, 1 ; <i32> [#uses=1] ; CHECK: %8 = sext i32 %7 to i64 ; CHECK: --> {1,+,2}<nuw><nsw><%bb> %8 = sext i32 %7 to i64 ; <i64> [#uses=1] -; CHECK: %9 = getelementptr inbounds double* %q, i64 %8 +; CHECK: %9 = getelementptr inbounds double, double* %q, i64 %8 ; CHECK: {(8 + %q),+,16}<nsw><%bb> - %9 = getelementptr inbounds double* %q, i64 %8 ; <double*> [#uses=1] + %9 = getelementptr inbounds double, double* %q, i64 %8 ; <double*> [#uses=1] ; Artificially repeat the above three instructions, this time using ; add nsw instead of or. @@ -48,16 +48,16 @@ bb: ; preds = %bb.nph, %bb1 ; CHECK: --> {1,+,2}<nuw><nsw><%bb> %t8 = sext i32 %t7 to i64 ; <i64> [#uses=1] -; CHECK: %t9 = getelementptr inbounds double* %q, i64 %t8 +; CHECK: %t9 = getelementptr inbounds double, double* %q, i64 %t8 ; CHECK: {(8 + %q),+,16}<nsw><%bb> - %t9 = getelementptr inbounds double* %q, i64 %t8 ; <double*> [#uses=1] + %t9 = getelementptr inbounds double, double* %q, i64 %t8 ; <double*> [#uses=1] - %10 = load double* %9, align 8 ; <double> [#uses=1] + %10 = load double, double* %9, align 8 ; <double> [#uses=1] %11 = fadd double %6, %10 ; <double> [#uses=1] %12 = fadd double %11, 3.200000e+00 ; <double> [#uses=1] %13 = fmul double %3, %12 ; <double> [#uses=1] %14 = sext i32 %i.01 to i64 ; <i64> [#uses=1] - %15 = getelementptr inbounds double* %d, i64 %14 ; <double*> [#uses=1] + %15 = getelementptr inbounds double, double* %d, i64 %14 ; <double*> [#uses=1] store double %13, double* %15, align 8 %16 = add nsw i32 %i.01, 2 ; <i32> [#uses=2] br label %bb1 diff --git a/test/Analysis/ScalarEvolution/nsw.ll b/test/Analysis/ScalarEvolution/nsw.ll index d776a5a..15444e3 100644 --- a/test/Analysis/ScalarEvolution/nsw.ll +++ b/test/Analysis/ScalarEvolution/nsw.ll @@ -7,7 +7,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" ; CHECK: Classifying expressions for: @test1 define void @test1(double* %p) nounwind { entry: - %tmp = load double* %p, align 8 ; <double> [#uses=1] + %tmp = load double, double* %p, align 8 ; <double> [#uses=1] %tmp1 = fcmp ogt double %tmp, 2.000000e+00 ; <i1> [#uses=1] br i1 %tmp1, label %bb.nph, label %return @@ -19,11 +19,11 @@ bb: ; preds = %bb1, %bb.nph ; CHECK: %i.01 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%bb> %tmp2 = sext i32 %i.01 to i64 ; <i64> [#uses=1] - %tmp3 = getelementptr double* %p, i64 %tmp2 ; <double*> [#uses=1] - %tmp4 = load double* %tmp3, align 8 ; <double> [#uses=1] + %tmp3 = getelementptr double, double* %p, i64 %tmp2 ; <double*> [#uses=1] + %tmp4 = load double, double* %tmp3, align 8 ; <double> [#uses=1] %tmp5 = fmul double %tmp4, 9.200000e+00 ; <double> [#uses=1] %tmp6 = sext i32 %i.01 to i64 ; <i64> [#uses=1] - %tmp7 = getelementptr double* %p, i64 %tmp6 ; <double*> [#uses=1] + %tmp7 = getelementptr double, double* %p, i64 %tmp6 ; <double*> [#uses=1] ; CHECK: %tmp7 ; CHECK-NEXT: --> {%p,+,8}<%bb> store double %tmp5, double* %tmp7, align 8 @@ -36,10 +36,10 @@ bb1: ; preds = %bb %phitmp = sext i32 %tmp8 to i64 ; <i64> [#uses=1] ; CHECK: %phitmp ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%bb> - %tmp9 = getelementptr double* %p, i64 %phitmp ; <double*> [#uses=1] + %tmp9 = getelementptr double, double* %p, i64 %phitmp ; <double*> [#uses=1] ; CHECK: %tmp9 ; CHECK-NEXT: --> {(8 + %p),+,8}<%bb> - %tmp10 = load double* %tmp9, align 8 ; <double> [#uses=1] + %tmp10 = load double, double* %tmp9, align 8 ; <double> [#uses=1] %tmp11 = fcmp ogt double %tmp10, 2.000000e+00 ; <i1> [#uses=1] br i1 %tmp11, label %bb, label %bb1.return_crit_edge @@ -64,7 +64,7 @@ for.body.i.i: ; preds = %for.body.i.i, %for. ; CHECK: %__first.addr.02.i.i ; CHECK-NEXT: --> {%begin,+,4}<nuw><%for.body.i.i> store i32 0, i32* %__first.addr.02.i.i, align 4 - %ptrincdec.i.i = getelementptr inbounds i32* %__first.addr.02.i.i, i64 1 + %ptrincdec.i.i = getelementptr inbounds i32, i32* %__first.addr.02.i.i, i64 1 ; CHECK: %ptrincdec.i.i ; CHECK-NEXT: --> {(4 + %begin),+,4}<nuw><%for.body.i.i> %cmp.i.i = icmp eq i32* %ptrincdec.i.i, %end @@ -90,10 +90,10 @@ for.body.i.i: ; preds = %entry, %for.body.i. %tmp = add nsw i64 %indvar.i.i, 1 ; CHECK: %tmp = ; CHECK: {1,+,1}<nuw><nsw><%for.body.i.i> - %ptrincdec.i.i = getelementptr inbounds i32* %begin, i64 %tmp + %ptrincdec.i.i = getelementptr inbounds i32, i32* %begin, i64 %tmp ; CHECK: %ptrincdec.i.i = ; CHECK: {(4 + %begin),+,4}<nsw><%for.body.i.i> - %__first.addr.08.i.i = getelementptr inbounds i32* %begin, i64 %indvar.i.i + %__first.addr.08.i.i = getelementptr inbounds i32, i32* %begin, i64 %indvar.i.i ; CHECK: %__first.addr.08.i.i ; CHECK: {%begin,+,4}<nsw><%for.body.i.i> store i32 0, i32* %__first.addr.08.i.i, align 4 @@ -124,17 +124,17 @@ exit: } ; CHECK-LABEL: PR12375 -; CHECK: --> {(4 + %arg),+,4}<nuw><%bb1> Exits: (8 + %arg)<nsw> +; CHECK: --> {(4 + %arg),+,4}<nuw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (8 + %arg)<nsw> define i32 @PR12375(i32* readnone %arg) { bb: - %tmp = getelementptr inbounds i32* %arg, i64 2 + %tmp = getelementptr inbounds i32, i32* %arg, i64 2 br label %bb1 bb1: ; preds = %bb1, %bb %tmp2 = phi i32* [ %arg, %bb ], [ %tmp5, %bb1 ] %tmp3 = phi i32 [ 0, %bb ], [ %tmp4, %bb1 ] %tmp4 = add nsw i32 %tmp3, 1 - %tmp5 = getelementptr inbounds i32* %tmp2, i64 1 + %tmp5 = getelementptr inbounds i32, i32* %tmp2, i64 1 %tmp6 = icmp ult i32* %tmp5, %tmp br i1 %tmp6, label %bb1, label %bb7 @@ -143,7 +143,7 @@ bb7: ; preds = %bb1 } ; CHECK-LABEL: PR12376 -; CHECK: --> {(4 + %arg),+,4}<nuw><%bb2> Exits: (4 + (4 * ((3 + (-1 * %arg) + (%arg umax %arg1)) /u 4)) + %arg) +; CHECK: --> {(4 + %arg),+,4}<nuw><%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((3 + (-1 * %arg) + (%arg umax %arg1)) /u 4)) + %arg) define void @PR12376(i32* nocapture %arg, i32* nocapture %arg1) { bb: br label %bb2 @@ -151,7 +151,7 @@ bb: bb2: ; preds = %bb2, %bb %tmp = phi i32* [ %arg, %bb ], [ %tmp4, %bb2 ] %tmp3 = icmp ult i32* %tmp, %arg1 - %tmp4 = getelementptr inbounds i32* %tmp, i64 1 + %tmp4 = getelementptr inbounds i32, i32* %tmp, i64 1 br i1 %tmp3, label %bb2, label %bb5 bb5: ; preds = %bb2 @@ -161,7 +161,7 @@ bb5: ; preds = %bb2 declare void @f(i32) ; CHECK-LABEL: nswnowrap -; CHECK: --> {(1 + %v),+,1}<nsw><%for.body> Exits: (2 + %v) +; CHECK: --> {(1 + %v),+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v) define void @nswnowrap(i32 %v) { entry: %add = add nsw i32 %v, 1 diff --git a/test/Analysis/ScalarEvolution/pr22179.ll b/test/Analysis/ScalarEvolution/pr22179.ll index d9fb510..21ed055 100644 --- a/test/Analysis/ScalarEvolution/pr22179.ll +++ b/test/Analysis/ScalarEvolution/pr22179.ll @@ -9,12 +9,12 @@ ; Function Attrs: nounwind ssp uwtable define i32 @main() { ; CHECK-LABEL: Classifying expressions for: @main - store i8 0, i8* getelementptr inbounds (%struct.anon* @a, i64 0, i32 0), align 1 + store i8 0, i8* getelementptr inbounds (%struct.anon, %struct.anon* @a, i64 0, i32 0), align 1 br label %loop loop: %storemerge1 = phi i8 [ 0, %0 ], [ %inc, %loop ] - %m = load volatile i32* getelementptr inbounds (%struct.S* @b, i64 0, i32 0), align 4 + %m = load volatile i32, i32* getelementptr inbounds (%struct.S, %struct.S* @b, i64 0, i32 0), align 4 %inc = add nuw i8 %storemerge1, 1 ; CHECK: %inc = add nuw i8 %storemerge1, 1 ; CHECK-NEXT: --> {1,+,1}<nuw><%loop> @@ -23,6 +23,6 @@ loop: br i1 %exitcond, label %exit, label %loop exit: - store i8 -128, i8* getelementptr inbounds (%struct.anon* @a, i64 0, i32 0), align 1 + store i8 -128, i8* getelementptr inbounds (%struct.anon, %struct.anon* @a, i64 0, i32 0), align 1 ret i32 0 } diff --git a/test/Analysis/ScalarEvolution/pr22674.ll b/test/Analysis/ScalarEvolution/pr22674.ll index 7defcb9..1bc7fd3 100644 --- a/test/Analysis/ScalarEvolution/pr22674.ll +++ b/test/Analysis/ScalarEvolution/pr22674.ll @@ -44,11 +44,11 @@ cond.false: ; preds = %for.end, %for.inc, unreachable _ZNK4llvm12AttributeSet3endEj.exit: ; preds = %for.end - %second.i.i.i = getelementptr inbounds %"struct.std::pair.241.2040.3839.6152.6923.7694.8465.9493.10007.10264.18507"* undef, i32 %I.099.lcssa129, i32 1 - %0 = load %"class.llvm::AttributeSetNode.230.2029.3828.6141.6912.7683.8454.9482.9996.10253.18506"** %second.i.i.i, align 4, !tbaa !2 - %NumAttrs.i.i.i = getelementptr inbounds %"class.llvm::AttributeSetNode.230.2029.3828.6141.6912.7683.8454.9482.9996.10253.18506"* %0, i32 0, i32 1 - %1 = load i32* %NumAttrs.i.i.i, align 4, !tbaa !8 - %add.ptr.i.i.i55 = getelementptr inbounds %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509"* undef, i32 %1 + %second.i.i.i = getelementptr inbounds %"struct.std::pair.241.2040.3839.6152.6923.7694.8465.9493.10007.10264.18507", %"struct.std::pair.241.2040.3839.6152.6923.7694.8465.9493.10007.10264.18507"* undef, i32 %I.099.lcssa129, i32 1 + %0 = load %"class.llvm::AttributeSetNode.230.2029.3828.6141.6912.7683.8454.9482.9996.10253.18506"*, %"class.llvm::AttributeSetNode.230.2029.3828.6141.6912.7683.8454.9482.9996.10253.18506"** %second.i.i.i, align 4, !tbaa !2 + %NumAttrs.i.i.i = getelementptr inbounds %"class.llvm::AttributeSetNode.230.2029.3828.6141.6912.7683.8454.9482.9996.10253.18506", %"class.llvm::AttributeSetNode.230.2029.3828.6141.6912.7683.8454.9482.9996.10253.18506"* %0, i32 0, i32 1 + %1 = load i32, i32* %NumAttrs.i.i.i, align 4, !tbaa !8 + %add.ptr.i.i.i55 = getelementptr inbounds %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509", %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509"* undef, i32 %1 br i1 undef, label %return, label %for.body11 for.cond9: ; preds = %_ZNK4llvm9Attribute13getKindAsEnumEv.exit @@ -58,7 +58,7 @@ for.cond9: ; preds = %_ZNK4llvm9Attribute for.body11: ; preds = %for.cond9, %_ZNK4llvm12AttributeSet3endEj.exit %I5.096 = phi %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509"* [ %incdec.ptr, %for.cond9 ], [ undef, %_ZNK4llvm12AttributeSet3endEj.exit ] %2 = bitcast %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509"* %I5.096 to i32* - %3 = load i32* %2, align 4, !tbaa !10 + %3 = load i32, i32* %2, align 4, !tbaa !10 %tobool.i59 = icmp eq i32 %3, 0 br i1 %tobool.i59, label %cond.false21, label %_ZNK4llvm9Attribute15isEnumAttributeEv.exit @@ -70,7 +70,7 @@ _ZNK4llvm9Attribute15isEnumAttributeEv.exit: ; preds = %for.body11 ] _ZNK4llvm9Attribute13getKindAsEnumEv.exit: ; preds = %_ZNK4llvm9Attribute15isEnumAttributeEv.exit, %_ZNK4llvm9Attribute15isEnumAttributeEv.exit - %incdec.ptr = getelementptr inbounds %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509"* %I5.096, i32 1 + %incdec.ptr = getelementptr inbounds %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509", %"class.llvm::Attribute.222.2021.3820.6133.6904.7675.8446.9474.9988.10245.18509"* %I5.096, i32 1 br i1 undef, label %for.cond9, label %return cond.false21: ; preds = %_ZNK4llvm9Attribute15isEnumAttributeEv.exit, %for.body11 diff --git a/test/Analysis/ScalarEvolution/pr22856.ll b/test/Analysis/ScalarEvolution/pr22856.ll new file mode 100644 index 0000000..89e8351 --- /dev/null +++ b/test/Analysis/ScalarEvolution/pr22856.ll @@ -0,0 +1,33 @@ +; RUN: opt -loop-reduce -verify < %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64--linux-gnu" + +define void @unbounded() { + +block_A: + %0 = sext i32 undef to i64 + br i1 undef, label %block_F, label %block_G + +block_C: ; preds = %block_F + br i1 undef, label %block_D, label %block_E + +block_D: ; preds = %block_D, %block_C + br i1 undef, label %block_E, label %block_D + +block_E: ; preds = %block_D, %block_C + %iv2 = phi i64 [ %4, %block_D ], [ %4, %block_C ] + %1 = add nsw i32 %iv1, 1 + %2 = icmp eq i32 %1, undef + br i1 %2, label %block_G, label %block_F + +block_F: ; preds = %block_E, %block_A + %iv3 = phi i64 [ %iv2, %block_E ], [ %0, %block_A ] + %iv1 = phi i32 [ %1, %block_E ], [ undef, %block_A ] + %3 = add nsw i64 %iv3, 2 + %4 = add nsw i64 %iv3, 1 + br label %block_C + +block_G: ; preds = %block_E, %block_A + ret void +} diff --git a/test/Analysis/ScalarEvolution/range-signedness.ll b/test/Analysis/ScalarEvolution/range-signedness.ll new file mode 100644 index 0000000..d04fc9e --- /dev/null +++ b/test/Analysis/ScalarEvolution/range-signedness.ll @@ -0,0 +1,39 @@ +; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s + +define void @x(i1* %cond) { +; CHECK-LABEL: Classifying expressions for: @x + entry: + br label %loop + + loop: + %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ] +; CHECK: %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ] +; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,-128) S: [0,-128) + + %idx.inc = add nsw i8 %idx, 1 + + %c = load volatile i1, i1* %cond + br i1 %c, label %loop, label %exit + + exit: + ret void +} + +define void @y(i8* %addr) { +; CHECK-LABEL: Classifying expressions for: @y + entry: + br label %loop + + loop: + %idx = phi i8 [-5, %entry ], [ %idx.inc, %loop ] +; CHECK: %idx = phi i8 [ -5, %entry ], [ %idx.inc, %loop ] +; CHECK-NEXT: --> {-5,+,1}<%loop> U: [-5,6) S: [-5,6) + + %idx.inc = add i8 %idx, 1 + + %continue = icmp slt i8 %idx.inc, 6 + br i1 %continue, label %loop, label %exit + + exit: + ret void +} diff --git a/test/Analysis/ScalarEvolution/scev-aa.ll b/test/Analysis/ScalarEvolution/scev-aa.ll index a0abbb7..e2123f4 100644 --- a/test/Analysis/ScalarEvolution/scev-aa.ll +++ b/test/Analysis/ScalarEvolution/scev-aa.ll @@ -19,11 +19,11 @@ entry: bb: %i = phi i64 [ 0, %entry ], [ %i.next, %bb ] - %pi = getelementptr double* %p, i64 %i + %pi = getelementptr double, double* %p, i64 %i %i.next = add i64 %i, 1 - %pi.next = getelementptr double* %p, i64 %i.next - %x = load double* %pi - %y = load double* %pi.next + %pi.next = getelementptr double, double* %p, i64 %i.next + %x = load double, double* %pi + %y = load double, double* %pi.next %z = fmul double %x, %y store double %z, double* %pi %exitcond = icmp eq i64 %i.next, %n @@ -58,18 +58,18 @@ bb: %i.next = add i64 %i, 1 %e = add i64 %i, %j - %pi.j = getelementptr double* %p, i64 %e + %pi.j = getelementptr double, double* %p, i64 %e %f = add i64 %i.next, %j - %pi.next.j = getelementptr double* %p, i64 %f - %x = load double* %pi.j - %y = load double* %pi.next.j + %pi.next.j = getelementptr double, double* %p, i64 %f + %x = load double, double* %pi.j + %y = load double, double* %pi.next.j %z = fmul double %x, %y store double %z, double* %pi.j %o = add i64 %j, 91 %g = add i64 %i, %o - %pi.j.next = getelementptr double* %p, i64 %g - %a = load double* %pi.j.next + %pi.j.next = getelementptr double, double* %p, i64 %g + %a = load double, double* %pi.j.next %b = fmul double %x, %a store double %b, double* %pi.j.next @@ -115,18 +115,18 @@ bb: %i.next = add i64 %i, 1 %e = add i64 %i, %j - %pi.j = getelementptr double* %p, i64 %e + %pi.j = getelementptr double, double* %p, i64 %e %f = add i64 %i.next, %j - %pi.next.j = getelementptr double* %p, i64 %f - %x = load double* %pi.j - %y = load double* %pi.next.j + %pi.next.j = getelementptr double, double* %p, i64 %f + %x = load double, double* %pi.j + %y = load double, double* %pi.next.j %z = fmul double %x, %y store double %z, double* %pi.j %o = add i64 %j, %n %g = add i64 %i, %o - %pi.j.next = getelementptr double* %p, i64 %g - %a = load double* %pi.j.next + %pi.j.next = getelementptr double, double* %p, i64 %g + %a = load double, double* %pi.j.next %b = fmul double %x, %a store double %b, double* %pi.j.next @@ -161,12 +161,12 @@ return: define void @foo() { entry: %A = alloca %struct.A - %B = getelementptr %struct.A* %A, i32 0, i32 0 + %B = getelementptr %struct.A, %struct.A* %A, i32 0, i32 0 %Q = bitcast %struct.B* %B to %struct.A* - %Z = getelementptr %struct.A* %Q, i32 0, i32 1 - %C = getelementptr %struct.B* %B, i32 1 + %Z = getelementptr %struct.A, %struct.A* %Q, i32 0, i32 1 + %C = getelementptr %struct.B, %struct.B* %B, i32 1 %X = bitcast %struct.B* %C to i32* - %Y = getelementptr %struct.A* %A, i32 0, i32 1 + %Y = getelementptr %struct.A, %struct.A* %A, i32 0, i32 1 ret void } @@ -181,12 +181,12 @@ entry: define void @bar() { %M = alloca %struct.A - %N = getelementptr %struct.A* %M, i32 0, i32 0 + %N = getelementptr %struct.A, %struct.A* %M, i32 0, i32 0 %O = bitcast %struct.B* %N to %struct.A* - %P = getelementptr %struct.A* %O, i32 0, i32 1 - %R = getelementptr %struct.B* %N, i32 1 + %P = getelementptr %struct.A, %struct.A* %O, i32 0, i32 1 + %R = getelementptr %struct.B, %struct.B* %N, i32 1 %W = bitcast %struct.B* %R to i32* - %V = getelementptr %struct.A* %M, i32 0, i32 1 + %V = getelementptr %struct.A, %struct.A* %M, i32 0, i32 1 ret void } @@ -200,9 +200,9 @@ entry: for.body: ; preds = %entry, %for.body %i = phi i64 [ %inc, %for.body ], [ 0, %entry ] ; <i64> [#uses=2] %inc = add nsw i64 %i, 1 ; <i64> [#uses=2] - %arrayidx = getelementptr inbounds i64* %p, i64 %inc + %arrayidx = getelementptr inbounds i64, i64* %p, i64 %inc store i64 0, i64* %arrayidx - %tmp6 = load i64* %p ; <i64> [#uses=1] + %tmp6 = load i64, i64* %p ; <i64> [#uses=1] %cmp = icmp slt i64 %inc, %tmp6 ; <i1> [#uses=1] br i1 %cmp, label %for.body, label %for.end diff --git a/test/Analysis/ScalarEvolution/scev-prestart-nowrap.ll b/test/Analysis/ScalarEvolution/scev-prestart-nowrap.ll index 3ca32bd..77f3482 100644 --- a/test/Analysis/ScalarEvolution/scev-prestart-nowrap.ll +++ b/test/Analysis/ScalarEvolution/scev-prestart-nowrap.ll @@ -66,7 +66,7 @@ define i64 @bad.1(i32 %start, i32 %low.limit, i32 %high.limit, i1* %unknown) { br i1 %break.early, label %continue.1, label %early.exit continue.1: - %cond = load volatile i1* %unknown + %cond = load volatile i1, i1* %unknown %idx.inc = add nsw i32 %idx, 1 br i1 %cond, label %loop, label %continue diff --git a/test/Analysis/ScalarEvolution/sext-inreg.ll b/test/Analysis/ScalarEvolution/sext-inreg.ll index 8b3d641..8f1d5bd 100644 --- a/test/Analysis/ScalarEvolution/sext-inreg.ll +++ b/test/Analysis/ScalarEvolution/sext-inreg.ll @@ -16,7 +16,7 @@ bb: ; preds = %bb, %entry %t2 = ashr i64 %t1, 7 ; <i32> [#uses=1] %s1 = shl i64 %i.01, 5 ; <i32> [#uses=1] %s2 = ashr i64 %s1, 5 ; <i32> [#uses=1] - %t3 = getelementptr i64* %x, i64 %i.01 ; <i64*> [#uses=1] + %t3 = getelementptr i64, i64* %x, i64 %i.01 ; <i64*> [#uses=1] store i64 0, i64* %t3, align 1 %indvar.next = add i64 %i.01, 199 ; <i32> [#uses=2] %exitcond = icmp eq i64 %indvar.next, %n ; <i1> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/sext-iv-0.ll b/test/Analysis/ScalarEvolution/sext-iv-0.ll index d5d3268..5634078 100644 --- a/test/Analysis/ScalarEvolution/sext-iv-0.ll +++ b/test/Analysis/ScalarEvolution/sext-iv-0.ll @@ -13,21 +13,21 @@ bb1.thread: bb1: ; preds = %bb1, %bb1.thread %i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ] ; <i64> [#uses=3] ; CHECK: %i.0.reg2mem.0 -; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127 +; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 %0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1] ; CHECK: %0 -; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127 +; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 %1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1] ; CHECK: %1 -; CHECK-NEXT: --> {-128,+,1}<%bb1> Exits: 127 +; CHECK-NEXT: --> {-128,+,1}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 %2 = sext i9 %1 to i64 ; <i64> [#uses=1] ; CHECK: %2 -; CHECK-NEXT: --> {-128,+,1}<nsw><%bb1> Exits: 127 - %3 = getelementptr double* %x, i64 %2 ; <double*> [#uses=1] - %4 = load double* %3, align 8 ; <double> [#uses=1] +; CHECK-NEXT: --> {-128,+,1}<nsw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 127 + %3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1] + %4 = load double, double* %3, align 8 ; <double> [#uses=1] %5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1] %6 = sext i8 %0 to i64 ; <i64> [#uses=1] - %7 = getelementptr double* %x, i64 %6 ; <double*> [#uses=1] + %7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1] store double %5, double* %7, align 8 %8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2] %9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/sext-iv-1.ll b/test/Analysis/ScalarEvolution/sext-iv-1.ll index a6f70db..575b744 100644 --- a/test/Analysis/ScalarEvolution/sext-iv-1.ll +++ b/test/Analysis/ScalarEvolution/sext-iv-1.ll @@ -23,11 +23,11 @@ bb1: ; preds = %bb1, %bb1.thread %0 = trunc i64 %i.0.reg2mem.0 to i7 ; <i8> [#uses=1] %1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1] %2 = sext i9 %1 to i64 ; <i64> [#uses=1] - %3 = getelementptr double* %x, i64 %2 ; <double*> [#uses=1] - %4 = load double* %3, align 8 ; <double> [#uses=1] + %3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1] + %4 = load double, double* %3, align 8 ; <double> [#uses=1] %5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1] %6 = sext i7 %0 to i64 ; <i64> [#uses=1] - %7 = getelementptr double* %x, i64 %6 ; <double*> [#uses=1] + %7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1] store double %5, double* %7, align 8 %8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2] %9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1] @@ -46,11 +46,11 @@ bb1: ; preds = %bb1, %bb1.thread %0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1] %1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1] %2 = sext i9 %1 to i64 ; <i64> [#uses=1] - %3 = getelementptr double* %x, i64 %2 ; <double*> [#uses=1] - %4 = load double* %3, align 8 ; <double> [#uses=1] + %3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1] + %4 = load double, double* %3, align 8 ; <double> [#uses=1] %5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1] %6 = sext i8 %0 to i64 ; <i64> [#uses=1] - %7 = getelementptr double* %x, i64 %6 ; <double*> [#uses=1] + %7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1] store double %5, double* %7, align 8 %8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2] %9 = icmp sgt i64 %8, 128 ; <i1> [#uses=1] @@ -69,11 +69,11 @@ bb1: ; preds = %bb1, %bb1.thread %0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1] %1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1] %2 = sext i9 %1 to i64 ; <i64> [#uses=1] - %3 = getelementptr double* %x, i64 %2 ; <double*> [#uses=1] - %4 = load double* %3, align 8 ; <double> [#uses=1] + %3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1] + %4 = load double, double* %3, align 8 ; <double> [#uses=1] %5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1] %6 = sext i8 %0 to i64 ; <i64> [#uses=1] - %7 = getelementptr double* %x, i64 %6 ; <double*> [#uses=1] + %7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1] store double %5, double* %7, align 8 %8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2] %9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1] @@ -92,11 +92,11 @@ bb1: ; preds = %bb1, %bb1.thread %0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1] %1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1] %2 = sext i9 %1 to i64 ; <i64> [#uses=1] - %3 = getelementptr double* %x, i64 %2 ; <double*> [#uses=1] - %4 = load double* %3, align 8 ; <double> [#uses=1] + %3 = getelementptr double, double* %x, i64 %2 ; <double*> [#uses=1] + %4 = load double, double* %3, align 8 ; <double> [#uses=1] %5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1] %6 = sext i8 %0 to i64 ; <i64> [#uses=1] - %7 = getelementptr double* %x, i64 %6 ; <double*> [#uses=1] + %7 = getelementptr double, double* %x, i64 %6 ; <double*> [#uses=1] store double %5, double* %7, align 8 %8 = add i64 %i.0.reg2mem.0, -1 ; <i64> [#uses=2] %9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/sext-iv-2.ll b/test/Analysis/ScalarEvolution/sext-iv-2.ll index 97e252c..8749ff3 100644 --- a/test/Analysis/ScalarEvolution/sext-iv-2.ll +++ b/test/Analysis/ScalarEvolution/sext-iv-2.ll @@ -1,9 +1,9 @@ ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s ; CHECK: %tmp3 = sext i8 %tmp2 to i32 -; CHECK: --> (sext i8 {0,+,1}<%bb1> to i32) Exits: -1 +; CHECK: --> (sext i8 {0,+,1}<%bb1> to i32){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: -1 ; CHECK: %tmp4 = mul i32 %tmp3, %i.02 -; CHECK: --> ((sext i8 {0,+,1}<%bb1> to i32) * {0,+,1}<%bb>) Exits: {0,+,-1}<%bb> +; CHECK: --> ((sext i8 {0,+,1}<%bb1> to i32) * {0,+,1}<%bb>){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: {0,+,-1}<%bb> ; These sexts are not foldable. @@ -32,7 +32,7 @@ bb1: ; preds = %bb2, %bb.nph %tmp4 = mul i32 %tmp3, %i.02 ; <i32> [#uses=1] %tmp5 = sext i32 %i.02 to i64 ; <i64> [#uses=1] %tmp6 = sext i32 %j.01 to i64 ; <i64> [#uses=1] - %tmp7 = getelementptr [32 x [256 x i32]]* @table, i64 0, i64 %tmp5, i64 %tmp6 ; <i32*> [#uses=1] + %tmp7 = getelementptr [32 x [256 x i32]], [32 x [256 x i32]]* @table, i64 0, i64 %tmp5, i64 %tmp6 ; <i32*> [#uses=1] store i32 %tmp4, i32* %tmp7, align 4 %tmp8 = add i32 %j.01, 1 ; <i32> [#uses=2] br label %bb2 @@ -56,7 +56,7 @@ bb4.bb5_crit_edge: ; preds = %bb4 br label %bb5 bb5: ; preds = %bb4.bb5_crit_edge, %entry - %tmp12 = load i32* getelementptr ([32 x [256 x i32]]* @table, i64 0, i64 9, i64 132), align 16 ; <i32> [#uses=1] + %tmp12 = load i32, i32* getelementptr ([32 x [256 x i32]], [32 x [256 x i32]]* @table, i64 0, i64 9, i64 132), align 16 ; <i32> [#uses=1] %tmp13 = icmp eq i32 %tmp12, -1116 ; <i1> [#uses=1] br i1 %tmp13, label %bb7, label %bb6 diff --git a/test/Analysis/ScalarEvolution/sle.ll b/test/Analysis/ScalarEvolution/sle.ll index f38f6b6..f24c480 100644 --- a/test/Analysis/ScalarEvolution/sle.ll +++ b/test/Analysis/ScalarEvolution/sle.ll @@ -14,8 +14,8 @@ entry: for.body: ; preds = %for.body, %entry %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] ; <i64> [#uses=2] - %arrayidx = getelementptr double* %p, i64 %i ; <double*> [#uses=2] - %t4 = load double* %arrayidx ; <double> [#uses=1] + %arrayidx = getelementptr double, double* %p, i64 %i ; <double*> [#uses=2] + %t4 = load double, double* %arrayidx ; <double> [#uses=1] %mul = fmul double %t4, 2.200000e+00 ; <double> [#uses=1] store double %mul, double* %arrayidx %i.next = add nsw i64 %i, 1 ; <i64> [#uses=2] diff --git a/test/Analysis/ScalarEvolution/trip-count.ll b/test/Analysis/ScalarEvolution/trip-count.ll index f89125a..1b75c88 100644 --- a/test/Analysis/ScalarEvolution/trip-count.ll +++ b/test/Analysis/ScalarEvolution/trip-count.ll @@ -1,16 +1,20 @@ ; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-max-iterations=0 | FileCheck %s ; PR1101 +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + @A = weak global [1000 x i32] zeroinitializer, align 32 +; CHECK: Printing analysis 'Scalar Evolution Analysis' for function 'test1': ; CHECK: backedge-taken count is 10000 -define void @test(i32 %N) { +define void @test1(i32 %N) { entry: br label %bb3 bb: ; preds = %bb3 - %tmp = getelementptr [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1] + %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1] store i32 123, i32* %tmp %tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1] br label %bb3 @@ -26,3 +30,61 @@ bb5: ; preds = %bb3 return: ; preds = %bb5 ret void } + +; PR22795 +; CHECK: Printing analysis 'Scalar Evolution Analysis' for function 'test2': +; CHECK: %iv = phi i32 [ -1, %entry ], [ %next.1, %for.inc.1 ] +; CHECK-NEXT: --> {-1,+,2}<%preheader> U: full-set S: full-set Exits: 13 + +define i32 @test2() { +entry: + %bins = alloca [16 x i64], align 16 + %0 = bitcast [16 x i64]* %bins to i8* + call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 128, i32 16, i1 false) + br label %preheader + +preheader: ; preds = %for.inc.1, %entry + %v11 = phi i64 [ 0, %entry ], [ %next12.1, %for.inc.1 ] + %iv = phi i32 [ -1, %entry ], [ %next.1, %for.inc.1 ] + %cmp = icmp sgt i64 %v11, 0 + br i1 %cmp, label %for.body, label %for.inc + +for.body: ; preds = %preheader + %zext = zext i32 %iv to i64 + %arrayidx = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 %v11 + %loaded = load i64, i64* %arrayidx, align 8 + %add = add i64 %loaded, 1 + %add2 = add i64 %add, %zext + store i64 %add2, i64* %arrayidx, align 8 + br label %for.inc + +for.inc: ; preds = %for.body, %preheader + %next12 = add nuw nsw i64 %v11, 1 + %next = add nsw i32 %iv, 1 + br i1 true, label %for.body.1, label %for.inc.1 + +end: ; preds = %for.inc.1 + %arrayidx8 = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 2 + %load = load i64, i64* %arrayidx8, align 16 + %shr4 = lshr i64 %load, 32 + %conv = trunc i64 %shr4 to i32 + ret i32 %conv + +for.body.1: ; preds = %for.inc + %zext.1 = zext i32 %next to i64 + %arrayidx.1 = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 %next12 + %loaded.1 = load i64, i64* %arrayidx.1, align 8 + %add.1 = add i64 %loaded.1, 1 + %add2.1 = add i64 %add.1, %zext.1 + store i64 %add2.1, i64* %arrayidx.1, align 8 + br label %for.inc.1 + +for.inc.1: ; preds = %for.body.1, %for.inc + %next12.1 = add nuw nsw i64 %next12, 1 + %next.1 = add nuw nsw i32 %next, 1 + %exitcond.1 = icmp eq i64 %next12.1, 16 + br i1 %exitcond.1, label %end, label %preheader +} + +; Function Attrs: nounwind +declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #0 diff --git a/test/Analysis/ScalarEvolution/trip-count11.ll b/test/Analysis/ScalarEvolution/trip-count11.ll index e14af08..819a89e 100644 --- a/test/Analysis/ScalarEvolution/trip-count11.ll +++ b/test/Analysis/ScalarEvolution/trip-count11.ll @@ -13,15 +13,15 @@ entry: for.cond: ; preds = %for.inc, %entry %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ] -; CHECK: --> %sum.0 Exits: 28 +; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] %cmp = icmp ult i32 %i.0, 8 br i1 %cmp, label %for.inc, label %for.end for.inc: ; preds = %for.cond %idxprom = sext i32 %i.0 to i64 - %arrayidx = getelementptr inbounds [8 x i32]* @foo.a, i64 0, i64 %idxprom - %0 = load i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds [8 x i32], [8 x i32]* @foo.a, i64 0, i64 %idxprom + %0 = load i32, i32* %arrayidx, align 4 %add = add nsw i32 %sum.0, %0 %inc = add nsw i32 %i.0, 1 br label %for.cond @@ -36,15 +36,15 @@ entry: for.cond: ; preds = %for.inc, %entry %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ] -; CHECK: --> %sum.0 Exits: 28 +; CHECK: --> %sum.0{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 28 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] %cmp = icmp ult i32 %i.0, 8 br i1 %cmp, label %for.inc, label %for.end for.inc: ; preds = %for.cond %idxprom = sext i32 %i.0 to i64 - %arrayidx = getelementptr inbounds [8 x i32] addrspace(1)* @foo.a_as1, i64 0, i64 %idxprom - %0 = load i32 addrspace(1)* %arrayidx, align 4 + %arrayidx = getelementptr inbounds [8 x i32], [8 x i32] addrspace(1)* @foo.a_as1, i64 0, i64 %idxprom + %0 = load i32, i32 addrspace(1)* %arrayidx, align 4 %add = add nsw i32 %sum.0, %0 %inc = add nsw i32 %i.0, 1 br label %for.cond diff --git a/test/Analysis/ScalarEvolution/trip-count12.ll b/test/Analysis/ScalarEvolution/trip-count12.ll index 8f960e1..d0086ee 100644 --- a/test/Analysis/ScalarEvolution/trip-count12.ll +++ b/test/Analysis/ScalarEvolution/trip-count12.ll @@ -16,8 +16,8 @@ for.body: ; preds = %for.body, %for.body %p.addr.05 = phi i16* [ %incdec.ptr, %for.body ], [ %p, %for.body.preheader ] %len.addr.04 = phi i32 [ %sub, %for.body ], [ %len, %for.body.preheader ] %res.03 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ] - %incdec.ptr = getelementptr inbounds i16* %p.addr.05, i32 1 - %0 = load i16* %p.addr.05, align 2 + %incdec.ptr = getelementptr inbounds i16, i16* %p.addr.05, i32 1 + %0 = load i16, i16* %p.addr.05, align 2 %conv = zext i16 %0 to i32 %add = add i32 %conv, %res.03 %sub = add nsw i32 %len.addr.04, -2 diff --git a/test/Analysis/ScalarEvolution/trip-count2.ll b/test/Analysis/ScalarEvolution/trip-count2.ll index e76488a..d988eff 100644 --- a/test/Analysis/ScalarEvolution/trip-count2.ll +++ b/test/Analysis/ScalarEvolution/trip-count2.ll @@ -10,7 +10,7 @@ entry: br label %bb3 bb: ; preds = %bb3 - %tmp = getelementptr [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1] + %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1] store i32 123, i32* %tmp %tmp4 = mul i32 %i.0, 4 ; <i32> [#uses=1] %tmp5 = or i32 %tmp4, 1 diff --git a/test/Analysis/ScalarEvolution/trip-count3.ll b/test/Analysis/ScalarEvolution/trip-count3.ll index 850e035..cce0182 100644 --- a/test/Analysis/ScalarEvolution/trip-count3.ll +++ b/test/Analysis/ScalarEvolution/trip-count3.ll @@ -48,10 +48,10 @@ sha_update.exit.exitStub: ; preds = %bb3.i ret void bb2.i: ; preds = %bb3.i - %1 = getelementptr %struct.SHA_INFO* %sha_info, i64 0, i32 3 + %1 = getelementptr %struct.SHA_INFO, %struct.SHA_INFO* %sha_info, i64 0, i32 3 %2 = bitcast [16 x i32]* %1 to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %buffer_addr.0.i, i64 64, i32 1, i1 false) - %3 = getelementptr %struct.SHA_INFO* %sha_info, i64 0, i32 3, i64 0 + %3 = getelementptr %struct.SHA_INFO, %struct.SHA_INFO* %sha_info, i64 0, i32 3, i64 0 %4 = bitcast i32* %3 to i8* br label %codeRepl @@ -61,7 +61,7 @@ codeRepl: ; preds = %bb2.i byte_reverse.exit.i: ; preds = %codeRepl call fastcc void @sha_transform(%struct.SHA_INFO* %sha_info) nounwind - %5 = getelementptr i8* %buffer_addr.0.i, i64 64 + %5 = getelementptr i8, i8* %buffer_addr.0.i, i64 64 %6 = add i32 %count_addr.0.i, -64 br label %bb3.i diff --git a/test/Analysis/ScalarEvolution/trip-count4.ll b/test/Analysis/ScalarEvolution/trip-count4.ll index b7184a4..966ffd2 100644 --- a/test/Analysis/ScalarEvolution/trip-count4.ll +++ b/test/Analysis/ScalarEvolution/trip-count4.ll @@ -12,8 +12,8 @@ loop: ; preds = %loop, %entry %indvar = phi i64 [ %n, %entry ], [ %indvar.next, %loop ] ; <i64> [#uses=4] %s0 = shl i64 %indvar, 8 ; <i64> [#uses=1] %indvar.i8 = ashr i64 %s0, 8 ; <i64> [#uses=1] - %t0 = getelementptr double* %d, i64 %indvar.i8 ; <double*> [#uses=2] - %t1 = load double* %t0 ; <double> [#uses=1] + %t0 = getelementptr double, double* %d, i64 %indvar.i8 ; <double*> [#uses=2] + %t1 = load double, double* %t0 ; <double> [#uses=1] %t2 = fmul double %t1, 1.000000e-01 ; <double> [#uses=1] store double %t2, double* %t0 %indvar.next = sub i64 %indvar, 1 ; <i64> [#uses=2] diff --git a/test/Analysis/ScalarEvolution/trip-count5.ll b/test/Analysis/ScalarEvolution/trip-count5.ll index 68a1ae1..dc02fed 100644 --- a/test/Analysis/ScalarEvolution/trip-count5.ll +++ b/test/Analysis/ScalarEvolution/trip-count5.ll @@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 define float @t(float* %pTmp1, float* %peakWeight, float* %nrgReducePeakrate, i32 %bim) nounwind { entry: - %tmp3 = load float* %peakWeight, align 4 ; <float> [#uses=2] + %tmp3 = load float, float* %peakWeight, align 4 ; <float> [#uses=2] %tmp2538 = icmp sgt i32 %bim, 0 ; <i1> [#uses=1] br i1 %tmp2538, label %bb.nph, label %bb4 @@ -21,13 +21,13 @@ bb: ; preds = %bb1, %bb.nph %hiPart.035 = phi i32 [ %tmp12, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=2] %peakCount.034 = phi float [ %tmp19, %bb1 ], [ %tmp3, %bb.nph ] ; <float> [#uses=1] %tmp6 = sext i32 %hiPart.035 to i64 ; <i64> [#uses=1] - %tmp7 = getelementptr float* %pTmp1, i64 %tmp6 ; <float*> [#uses=1] - %tmp8 = load float* %tmp7, align 4 ; <float> [#uses=1] + %tmp7 = getelementptr float, float* %pTmp1, i64 %tmp6 ; <float*> [#uses=1] + %tmp8 = load float, float* %tmp7, align 4 ; <float> [#uses=1] %tmp10 = fadd float %tmp8, %distERBhi.036 ; <float> [#uses=3] %tmp12 = add i32 %hiPart.035, 1 ; <i32> [#uses=3] %tmp15 = sext i32 %tmp12 to i64 ; <i64> [#uses=1] - %tmp16 = getelementptr float* %peakWeight, i64 %tmp15 ; <float*> [#uses=1] - %tmp17 = load float* %tmp16, align 4 ; <float> [#uses=1] + %tmp16 = getelementptr float, float* %peakWeight, i64 %tmp15 ; <float*> [#uses=1] + %tmp17 = load float, float* %tmp16, align 4 ; <float> [#uses=1] %tmp19 = fadd float %tmp17, %peakCount.034 ; <float> [#uses=2] br label %bb1 diff --git a/test/Analysis/ScalarEvolution/trip-count6.ll b/test/Analysis/ScalarEvolution/trip-count6.ll index 0f394a0..7980bbd 100644 --- a/test/Analysis/ScalarEvolution/trip-count6.ll +++ b/test/Analysis/ScalarEvolution/trip-count6.ll @@ -12,8 +12,8 @@ entry: bb: ; preds = %bb4, %entry %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ] ; <i8> [#uses=4] zext i8 %mode.0 to i32 ; <i32>:1 [#uses=1] - getelementptr [4 x i32]* @mode_table, i32 0, i32 %1 ; <i32*>:2 [#uses=1] - load i32* %2, align 4 ; <i32>:3 [#uses=1] + getelementptr [4 x i32], [4 x i32]* @mode_table, i32 0, i32 %1 ; <i32*>:2 [#uses=1] + load i32, i32* %2, align 4 ; <i32>:3 [#uses=1] icmp eq i32 %3, %0 ; <i1>:4 [#uses=1] br i1 %4, label %bb1, label %bb2 diff --git a/test/Analysis/ScalarEvolution/trip-count7.ll b/test/Analysis/ScalarEvolution/trip-count7.ll index d01a18a..bbe76c4 100644 --- a/test/Analysis/ScalarEvolution/trip-count7.ll +++ b/test/Analysis/ScalarEvolution/trip-count7.ll @@ -72,57 +72,57 @@ bb.i: ; preds = %bb7.i %tmp = add i32 %j.0.i, 1 ; <i32> [#uses=5] store i32 0, i32* %q, align 4 %tmp1 = sext i32 %tmp to i64 ; <i64> [#uses=1] - %tmp2 = getelementptr [9 x i32]* %a, i64 0, i64 %tmp1 ; <i32*> [#uses=1] - %tmp3 = load i32* %tmp2, align 4 ; <i32> [#uses=1] + %tmp2 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp1 ; <i32*> [#uses=1] + %tmp3 = load i32, i32* %tmp2, align 4 ; <i32> [#uses=1] %tmp4 = icmp eq i32 %tmp3, 0 ; <i1> [#uses=1] br i1 %tmp4, label %bb.i.bb7.i.backedge_crit_edge, label %bb1.i bb1.i: ; preds = %bb.i %tmp5 = add i32 %j.0.i, 2 ; <i32> [#uses=1] %tmp6 = sext i32 %tmp5 to i64 ; <i64> [#uses=1] - %tmp7 = getelementptr [17 x i32]* %b, i64 0, i64 %tmp6 ; <i32*> [#uses=1] - %tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1] + %tmp7 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp6 ; <i32*> [#uses=1] + %tmp8 = load i32, i32* %tmp7, align 4 ; <i32> [#uses=1] %tmp9 = icmp eq i32 %tmp8, 0 ; <i1> [#uses=1] br i1 %tmp9, label %bb1.i.bb7.i.backedge_crit_edge, label %bb2.i bb2.i: ; preds = %bb1.i %tmp10 = sub i32 7, %j.0.i ; <i32> [#uses=1] %tmp11 = sext i32 %tmp10 to i64 ; <i64> [#uses=1] - %tmp12 = getelementptr [15 x i32]* %c, i64 0, i64 %tmp11 ; <i32*> [#uses=1] - %tmp13 = load i32* %tmp12, align 4 ; <i32> [#uses=1] + %tmp12 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp11 ; <i32*> [#uses=1] + %tmp13 = load i32, i32* %tmp12, align 4 ; <i32> [#uses=1] %tmp14 = icmp eq i32 %tmp13, 0 ; <i1> [#uses=1] br i1 %tmp14, label %bb2.i.bb7.i.backedge_crit_edge, label %bb3.i bb3.i: ; preds = %bb2.i - %tmp15 = getelementptr [9 x i32]* %x1, i64 0, i64 1 ; <i32*> [#uses=1] + %tmp15 = getelementptr [9 x i32], [9 x i32]* %x1, i64 0, i64 1 ; <i32*> [#uses=1] store i32 %tmp, i32* %tmp15, align 4 %tmp16 = sext i32 %tmp to i64 ; <i64> [#uses=1] - %tmp17 = getelementptr [9 x i32]* %a, i64 0, i64 %tmp16 ; <i32*> [#uses=1] + %tmp17 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp16 ; <i32*> [#uses=1] store i32 0, i32* %tmp17, align 4 %tmp18 = add i32 %j.0.i, 2 ; <i32> [#uses=1] %tmp19 = sext i32 %tmp18 to i64 ; <i64> [#uses=1] - %tmp20 = getelementptr [17 x i32]* %b, i64 0, i64 %tmp19 ; <i32*> [#uses=1] + %tmp20 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp19 ; <i32*> [#uses=1] store i32 0, i32* %tmp20, align 4 %tmp21 = sub i32 7, %j.0.i ; <i32> [#uses=1] %tmp22 = sext i32 %tmp21 to i64 ; <i64> [#uses=1] - %tmp23 = getelementptr [15 x i32]* %c, i64 0, i64 %tmp22 ; <i32*> [#uses=1] + %tmp23 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp22 ; <i32*> [#uses=1] store i32 0, i32* %tmp23, align 4 call void @Try(i32 2, i32* %q, i32* %b9, i32* %a10, i32* %c11, i32* %x1.sub) nounwind - %tmp24 = load i32* %q, align 4 ; <i32> [#uses=1] + %tmp24 = load i32, i32* %q, align 4 ; <i32> [#uses=1] %tmp25 = icmp eq i32 %tmp24, 0 ; <i1> [#uses=1] br i1 %tmp25, label %bb5.i, label %bb3.i.bb7.i.backedge_crit_edge bb5.i: ; preds = %bb3.i %tmp26 = sext i32 %tmp to i64 ; <i64> [#uses=1] - %tmp27 = getelementptr [9 x i32]* %a, i64 0, i64 %tmp26 ; <i32*> [#uses=1] + %tmp27 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp26 ; <i32*> [#uses=1] store i32 1, i32* %tmp27, align 4 %tmp28 = add i32 %j.0.i, 2 ; <i32> [#uses=1] %tmp29 = sext i32 %tmp28 to i64 ; <i64> [#uses=1] - %tmp30 = getelementptr [17 x i32]* %b, i64 0, i64 %tmp29 ; <i32*> [#uses=1] + %tmp30 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp29 ; <i32*> [#uses=1] store i32 1, i32* %tmp30, align 4 %tmp31 = sub i32 7, %j.0.i ; <i32> [#uses=1] %tmp32 = sext i32 %tmp31 to i64 ; <i64> [#uses=1] - %tmp33 = getelementptr [15 x i32]* %c, i64 0, i64 %tmp32 ; <i32*> [#uses=1] + %tmp33 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp32 ; <i32*> [#uses=1] store i32 1, i32* %tmp33, align 4 br label %bb7.i.backedge @@ -131,7 +131,7 @@ bb7.i.backedge: ; preds = %bb3.i.bb7.i.backedge_crit_edge, %bb2.i.bb7.i.backedg bb7.i: ; preds = %bb7.i.backedge, %newFuncRoot %j.0.i = phi i32 [ 0, %newFuncRoot ], [ %tmp, %bb7.i.backedge ] ; <i32> [#uses=8] - %tmp34 = load i32* %q, align 4 ; <i32> [#uses=1] + %tmp34 = load i32, i32* %q, align 4 ; <i32> [#uses=1] %tmp35 = icmp eq i32 %tmp34, 0 ; <i1> [#uses=1] %tmp36 = icmp ne i32 %j.0.i, 8 ; <i1> [#uses=1] %tmp37 = and i1 %tmp35, %tmp36 ; <i1> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/zext-signed-addrec.ll b/test/Analysis/ScalarEvolution/zext-signed-addrec.ll index 4369820..31ebb3e 100644 --- a/test/Analysis/ScalarEvolution/zext-signed-addrec.ll +++ b/test/Analysis/ScalarEvolution/zext-signed-addrec.ll @@ -15,16 +15,16 @@ target triple = "x86_64-unknown-linux-gnu" ; CHECK-LABEL: foo define i32 @foo() { entry: - %.pr = load i32* @b, align 4 + %.pr = load i32, i32* @b, align 4 %cmp10 = icmp slt i32 %.pr, 1 br i1 %cmp10, label %for.cond1.preheader.lr.ph, label %entry.for.end9_crit_edge entry.for.end9_crit_edge: ; preds = %entry - %.pre = load i32* @c, align 4 + %.pre = load i32, i32* @c, align 4 br label %for.end9 for.cond1.preheader.lr.ph: ; preds = %entry - %0 = load i32* @a, align 4 + %0 = load i32, i32* @a, align 4 %tobool = icmp eq i32 %0, 0 br i1 %tobool, label %for.cond1.preheader.for.cond1.preheader.split_crit_edge, label %return.loopexit.split @@ -63,7 +63,7 @@ for.cond.for.end9_crit_edge: ; preds = %for.inc8 for.end9: ; preds = %entry.for.end9_crit_edge, %for.cond.for.end9_crit_edge %3 = phi i32 [ %.pre, %entry.for.end9_crit_edge ], [ %shl, %for.cond.for.end9_crit_edge ] - %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %3) #2 + %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3) #2 br label %return return.loopexit.split: ; preds = %for.cond1.preheader.lr.ph diff --git a/test/Analysis/ScalarEvolution/zext-wrap.ll b/test/Analysis/ScalarEvolution/zext-wrap.ll index 104ed41..f56e455 100644 --- a/test/Analysis/ScalarEvolution/zext-wrap.ll +++ b/test/Analysis/ScalarEvolution/zext-wrap.ll @@ -10,7 +10,7 @@ bb.i: ; preds = %bb1.i, %bb.nph ; This cast shouldn't be folded into the addrec. ; CHECK: %tmp = zext i8 %l_95.0.i1 to i16 -; CHECK: --> (zext i8 {0,+,-1}<%bb.i> to i16) Exits: 2 +; CHECK: --> (zext i8 {0,+,-1}<%bb.i> to i16){{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: 2 %tmp = zext i8 %l_95.0.i1 to i16 |