diff options
author | ed <ed@FreeBSD.org> | 2009-06-22 08:08:12 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-22 08:08:12 +0000 |
commit | a4c19d68f13cf0a83bc0da53bd6d547fcaf635fe (patch) | |
tree | 86c1bc482baa6c81fc70b8d715153bfa93377186 /test | |
parent | db89e312d968c258aba3c79c1c398f5fb19267a3 (diff) | |
download | FreeBSD-src-a4c19d68f13cf0a83bc0da53bd6d547fcaf635fe.zip FreeBSD-src-a4c19d68f13cf0a83bc0da53bd6d547fcaf635fe.tar.gz |
Update LLVM sources to r73879.
Diffstat (limited to 'test')
90 files changed, 2870 insertions, 67 deletions
diff --git a/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll b/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll index a2cbcee..bf27e77 100644 --- a/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll +++ b/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | grep {Loop bb: backedge-taken count is 100} ; PR1533 diff --git a/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll b/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll index 34d9766..95f932a 100644 --- a/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll +++ b/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb: backedge-taken count is (-1 + (-1 \\* %x) + %y)} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output | grep {Loop bb: backedge-taken count is (-1 + (-1 \\* %x) + %y)} ; PR1597 define i32 @f(i32 %x, i32 %y) { diff --git a/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll b/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll index c4de093..e5e47d5 100644 --- a/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll +++ b/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 13} ; PR1706 diff --git a/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll b/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll index 82d6ee2..01f338a 100644 --- a/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll +++ b/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep -e {--> %b} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep -e {--> %b} ; PR1810 define void @fun() { diff --git a/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll b/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll index 182a087..b9a53b3 100644 --- a/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll +++ b/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop header: backedge-taken count is (0 smax %n)} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output | grep {Loop header: backedge-taken count is (0 smax %n)} define void @foo(i32 %n) { entry: diff --git a/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll b/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll index cd3a80f..b943bc7 100644 --- a/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll +++ b/test/Analysis/ScalarEvolution/2008-02-12-SMAXTripCount.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop loop: backedge-taken count is (100 + (-100 smax %n))} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output | grep {Loop loop: backedge-taken count is (100 + (-100 smax %n))} ; PR2002 define void @foo(i8 %n) { diff --git a/test/Analysis/ScalarEvolution/2008-02-15-UMax.ll b/test/Analysis/ScalarEvolution/2008-02-15-UMax.ll index 0f977f8..59b5109 100644 --- a/test/Analysis/ScalarEvolution/2008-02-15-UMax.ll +++ b/test/Analysis/ScalarEvolution/2008-02-15-UMax.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep umax +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep umax ; PR2003 define i32 @foo(i32 %n) { diff --git a/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll b/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll index 13852d4..5453ae3 100644 --- a/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll +++ b/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 61} ; PR2364 diff --git a/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll b/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll index a0fcad7..6ba0f25 100644 --- a/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll +++ b/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& not grep smax +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output |& not grep smax ; PR2261 @lut = common global [256 x i8] zeroinitializer, align 32 ; <[256 x i8]*> [#uses=1] diff --git a/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect2.ll b/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect2.ll index 5501ee2..3c022e7 100644 --- a/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect2.ll +++ b/test/Analysis/ScalarEvolution/2008-07-12-UnneededSelect2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& not grep smax +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output |& not grep smax ; PR2070 define i32 @a(i32 %x) nounwind { diff --git a/test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll b/test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll index a3cc600..5dcad53 100644 --- a/test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll +++ b/test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | grep Unpredictable ; PR2088 diff --git a/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll b/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll index 9ba118c..54c929d 100644 --- a/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll +++ b/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 113} ; PR2088 diff --git a/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll b/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll index c6cb87f..1e9d0bf 100644 --- a/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll +++ b/test/Analysis/ScalarEvolution/2008-11-02-QuadraticCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output ; PR1827 declare void @use(i32) diff --git a/test/Analysis/ScalarEvolution/2008-11-15-CubicOOM.ll b/test/Analysis/ScalarEvolution/2008-11-15-CubicOOM.ll index 89e9efa..c0b3a1f 100644 --- a/test/Analysis/ScalarEvolution/2008-11-15-CubicOOM.ll +++ b/test/Analysis/ScalarEvolution/2008-11-15-CubicOOM.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output ; PR2602 define i32 @a() nounwind { diff --git a/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll b/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll index 0651fd8..56d1fe7 100644 --- a/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll +++ b/test/Analysis/ScalarEvolution/2008-11-18-LessThanOrEqual.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output |& \ ; RUN: grep {Loop bb: backedge-taken count is (7 + (-1 \\* %argc))} ; XFAIL: * diff --git a/test/Analysis/ScalarEvolution/2008-11-18-Stride1.ll b/test/Analysis/ScalarEvolution/2008-11-18-Stride1.ll index 78cda0e..8fb1604 100644 --- a/test/Analysis/ScalarEvolution/2008-11-18-Stride1.ll +++ b/test/Analysis/ScalarEvolution/2008-11-18-Stride1.ll @@ -1,4 +1,9 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& grep {/u 3} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ +; RUN: | grep {Loop bb: Unpredictable backedge-taken count\\.} + +; ScalarEvolution can't compute a trip count because it doesn't know if +; dividing by the stride will have a remainder. This could theoretically +; be teaching it how to use a more elaborate trip count computation. define i32 @f(i32 %x) nounwind readnone { entry: diff --git a/test/Analysis/ScalarEvolution/2008-11-18-Stride2.ll b/test/Analysis/ScalarEvolution/2008-11-18-Stride2.ll index 4a76970..d506f9c 100644 --- a/test/Analysis/ScalarEvolution/2008-11-18-Stride2.ll +++ b/test/Analysis/ScalarEvolution/2008-11-18-Stride2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& grep {/u 3} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output |& grep {/u 3} ; XFAIL: * define i32 @f(i32 %x) nounwind readnone { diff --git a/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll b/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll index 3df1fe0..643d2f8 100644 --- a/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll +++ b/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {backedge-taken count is 255} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep {backedge-taken count is 255} ; XFAIL: * define i32 @foo(i32 %x, i32 %y, i32* %lam, i32* %alp) nounwind { diff --git a/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll b/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll index 9703bcb..995a1d9 100644 --- a/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll +++ b/test/Analysis/ScalarEvolution/2008-12-11-SMaxOverflow.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {0 smax} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep {0 smax} ; XFAIL: * define i32 @f(i32 %c.idx.val) { diff --git a/test/Analysis/ScalarEvolution/2008-12-14-StrideAndSigned.ll b/test/Analysis/ScalarEvolution/2008-12-14-StrideAndSigned.ll index 4d4fcd7..8e064c7 100644 --- a/test/Analysis/ScalarEvolution/2008-12-14-StrideAndSigned.ll +++ b/test/Analysis/ScalarEvolution/2008-12-14-StrideAndSigned.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output |& \ ; RUN: grep {(((-1 \\* %i0) + (100005 smax %i0)) /u 5)} ; XFAIL: * diff --git a/test/Analysis/ScalarEvolution/2008-12-15-DontUseSDiv.ll b/test/Analysis/ScalarEvolution/2008-12-15-DontUseSDiv.ll index 2557c8b..950c1d2 100644 --- a/test/Analysis/ScalarEvolution/2008-12-15-DontUseSDiv.ll +++ b/test/Analysis/ScalarEvolution/2008-12-15-DontUseSDiv.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& grep {/u 5} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output |& grep {/u 5} ; XFAIL: * define i8 @foo0(i8 %i0) nounwind { diff --git a/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll b/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll index 07714cd..65c4cdb 100644 --- a/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll +++ b/test/Analysis/ScalarEvolution/2009-01-02-SignedNegativeStride.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | not grep {/u -1} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | not grep {/u -1} ; PR3275 @g_16 = external global i16 ; <i16*> [#uses=3] diff --git a/test/Analysis/ScalarEvolution/2009-04-22-TruncCast.ll b/test/Analysis/ScalarEvolution/2009-04-22-TruncCast.ll index c23f0f0..6aced23 100644 --- a/test/Analysis/ScalarEvolution/2009-04-22-TruncCast.ll +++ b/test/Analysis/ScalarEvolution/2009-04-22-TruncCast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {(trunc i} | not grep ext +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep {(trunc i} | not grep ext define i16 @test1(i8 %x) { %A = sext i8 %x to i32 diff --git a/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll b/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll index bea46a7..5e5128b 100644 --- a/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll +++ b/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {count is 2} +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep {count is 2} ; PR3171 %struct.Foo = type { i32 } diff --git a/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll b/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll index 76ca4a0..27a546f 100644 --- a/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll +++ b/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 100} ; PR1101 diff --git a/test/Analysis/ScalarEvolution/avoid-smax-0.ll b/test/Analysis/ScalarEvolution/avoid-smax-0.ll index df39cc0..ce7ee77 100644 --- a/test/Analysis/ScalarEvolution/avoid-smax-0.ll +++ b/test/Analysis/ScalarEvolution/avoid-smax-0.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb3: backedge-taken count is (-1 + %n)} +; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output | grep {Loop bb3: backedge-taken count is (-1 + %n)} ; We don't want to use a max in the trip count expression in ; this testcase. diff --git a/test/Analysis/ScalarEvolution/do-loop.ll b/test/Analysis/ScalarEvolution/do-loop.ll index c6b3298..85c38e4 100644 --- a/test/Analysis/ScalarEvolution/do-loop.ll +++ b/test/Analysis/ScalarEvolution/do-loop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep smax +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep smax ; PR1614 define i32 @f(i32 %x, i32 %y) { diff --git a/test/Analysis/ScalarEvolution/smax.ll b/test/Analysis/ScalarEvolution/smax.ll index 4818ee9..366dfde 100644 --- a/test/Analysis/ScalarEvolution/smax.ll +++ b/test/Analysis/ScalarEvolution/smax.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep smax | count 2 -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep smax | count 2 +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | grep \ ; RUN: {%. smax %. smax %.} ; PR1614 diff --git a/test/Analysis/ScalarEvolution/trip-count.ll b/test/Analysis/ScalarEvolution/trip-count.ll index f8894d6..c5be858 100644 --- a/test/Analysis/ScalarEvolution/trip-count.ll +++ b/test/Analysis/ScalarEvolution/trip-count.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \ ; RUN: -scalar-evolution-max-iterations=0 | grep {backedge-taken count is 10000} ; PR1101 diff --git a/test/Analysis/ScalarEvolution/trip-count2.ll b/test/Analysis/ScalarEvolution/trip-count2.ll index 8615c76..374a562 100644 --- a/test/Analysis/ScalarEvolution/trip-count2.ll +++ b/test/Analysis/ScalarEvolution/trip-count2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -analyze -scalar-evolution | \ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output | \ ; RUN: grep {backedge-taken count is 4} ; PR1101 diff --git a/test/Analysis/ScalarEvolution/trip-count3.ll b/test/Analysis/ScalarEvolution/trip-count3.ll index a95138f..35c8683 100644 --- a/test/Analysis/ScalarEvolution/trip-count3.ll +++ b/test/Analysis/ScalarEvolution/trip-count3.ll @@ -1,5 +1,9 @@ ; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output \ -; RUN: | grep {backedge-taken count is ((64 + (-64 smax (-1 + (-1 \\* %0))) + %0) /u 64)} +; RUN: | grep {Loop bb3\\.i: Unpredictable backedge-taken count\\.} + +; ScalarEvolution can't compute a trip count because it doesn't know if +; dividing by the stride will have a remainder. This could theoretically +; be teaching it how to use a more elaborate trip count computation. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/Analysis/ScalarEvolution/trip-count5.ll b/test/Analysis/ScalarEvolution/trip-count5.ll new file mode 100644 index 0000000..822dc26 --- /dev/null +++ b/test/Analysis/ScalarEvolution/trip-count5.ll @@ -0,0 +1,48 @@ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output > %t +; RUN: grep sext %t | count 2 +; RUN: not grep {(sext} %t + +; ScalarEvolution should be able to compute a maximum trip count +; value sufficient to fold away both sext casts. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" + +define float @t(float* %pTmp1, float* %peakWeight, float* %nrgReducePeakrate, i32 %bim) nounwind { +entry: + %tmp3 = load float* %peakWeight, align 4 ; <float> [#uses=2] + %tmp2538 = icmp sgt i32 %bim, 0 ; <i1> [#uses=1] + br i1 %tmp2538, label %bb.nph, label %bb4 + +bb.nph: ; preds = %entry + br label %bb + +bb: ; preds = %bb1, %bb.nph + %distERBhi.036 = phi float [ %tmp10, %bb1 ], [ 0.000000e+00, %bb.nph ] ; <float> [#uses=1] + %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] + %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] + %tmp19 = fadd float %tmp17, %peakCount.034 ; <float> [#uses=2] + br label %bb1 + +bb1: ; preds = %bb + %tmp21 = fcmp olt float %tmp10, 2.500000e+00 ; <i1> [#uses=1] + %tmp25 = icmp slt i32 %tmp12, %bim ; <i1> [#uses=1] + %tmp27 = and i1 %tmp21, %tmp25 ; <i1> [#uses=1] + br i1 %tmp27, label %bb, label %bb1.bb4_crit_edge + +bb1.bb4_crit_edge: ; preds = %bb1 + br label %bb4 + +bb4: ; preds = %bb1.bb4_crit_edge, %entry + %distERBhi.0.lcssa = phi float [ %tmp10, %bb1.bb4_crit_edge ], [ 0.000000e+00, %entry ] ; <float> [#uses=1] + %peakCount.0.lcssa = phi float [ %tmp19, %bb1.bb4_crit_edge ], [ %tmp3, %entry ] ; <float> [#uses=1] + %tmp31 = fdiv float %peakCount.0.lcssa, %distERBhi.0.lcssa ; <float> [#uses=1] + ret float %tmp31 +} diff --git a/test/Analysis/ScalarEvolution/xor-and.ll b/test/Analysis/ScalarEvolution/xor-and.ll new file mode 100644 index 0000000..8430524 --- /dev/null +++ b/test/Analysis/ScalarEvolution/xor-and.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | opt -scalar-evolution -disable-output -analyze \ +; RUN: | grep {\\--> (zext i4 (-8 + (trunc i64 (8 \\* %x) to i4)) to i64)} + +; ScalarEvolution shouldn't try to analyze %z into something like +; --> (zext i4 (-1 + (-1 * (trunc i64 (8 * %x) to i4))) to i64) + +define i64 @foo(i64 %x) { + %a = shl i64 %x, 3 + %t = and i64 %a, 8 + %z = xor i64 %t, 8 + ret i64 %z +} diff --git a/test/CodeGen/ARM/2009-06-15-RegScavengerAssert.ll b/test/CodeGen/ARM/2009-06-15-RegScavengerAssert.ll new file mode 100644 index 0000000..c715a18 --- /dev/null +++ b/test/CodeGen/ARM/2009-06-15-RegScavengerAssert.ll @@ -0,0 +1,344 @@ +; RUN: llvm-as < %s | llc -mtriple=armv6-apple-darwin + + %struct.term = type { i32, i32, i32 } + +declare fastcc i8* @memory_Malloc(i32) nounwind + +define fastcc %struct.term* @t1() nounwind { +entry: + br i1 undef, label %bb, label %bb1 + +bb: ; preds = %entry + ret %struct.term* undef + +bb1: ; preds = %entry + %0 = tail call fastcc i8* @memory_Malloc(i32 12) nounwind ; <i8*> [#uses=0] + %1 = tail call fastcc i8* @memory_Malloc(i32 12) nounwind ; <i8*> [#uses=0] + ret %struct.term* undef +} + + +define i32 @t2(i32 %argc, i8** nocapture %argv) nounwind { +entry: + br label %bb6.i8 + +bb6.i8: ; preds = %memory_CalculateRealBlockSize1374.exit.i, %entry + br i1 undef, label %memory_CalculateRealBlockSize1374.exit.i, label %bb.i.i9 + +bb.i.i9: ; preds = %bb6.i8 + br label %memory_CalculateRealBlockSize1374.exit.i + +memory_CalculateRealBlockSize1374.exit.i: ; preds = %bb.i.i9, %bb6.i8 + %0 = phi i32 [ undef, %bb.i.i9 ], [ undef, %bb6.i8 ] ; <i32> [#uses=2] + store i32 %0, i32* undef, align 4 + %1 = urem i32 8184, %0 ; <i32> [#uses=1] + %2 = sub i32 8188, %1 ; <i32> [#uses=1] + store i32 %2, i32* undef, align 4 + br i1 undef, label %memory_Init.exit, label %bb6.i8 + +memory_Init.exit: ; preds = %memory_CalculateRealBlockSize1374.exit.i + br label %bb.i.i + +bb.i.i: ; preds = %bb.i.i, %memory_Init.exit + br i1 undef, label %symbol_Init.exit, label %bb.i.i + +symbol_Init.exit: ; preds = %bb.i.i + br label %bb.i.i67 + +bb.i.i67: ; preds = %bb.i.i67, %symbol_Init.exit + br i1 undef, label %symbol_CreatePrecedence3522.exit, label %bb.i.i67 + +symbol_CreatePrecedence3522.exit: ; preds = %bb.i.i67 + br label %bb.i.i8.i + +bb.i.i8.i: ; preds = %bb.i.i8.i, %symbol_CreatePrecedence3522.exit + br i1 undef, label %cont_Create.exit9.i, label %bb.i.i8.i + +cont_Create.exit9.i: ; preds = %bb.i.i8.i + br label %bb.i.i.i72 + +bb.i.i.i72: ; preds = %bb.i.i.i72, %cont_Create.exit9.i + br i1 undef, label %cont_Init.exit, label %bb.i.i.i72 + +cont_Init.exit: ; preds = %bb.i.i.i72 + br label %bb.i103 + +bb.i103: ; preds = %bb.i103, %cont_Init.exit + br i1 undef, label %subs_Init.exit, label %bb.i103 + +subs_Init.exit: ; preds = %bb.i103 + br i1 undef, label %bb1.i.i.i80, label %cc_Init.exit + +bb1.i.i.i80: ; preds = %subs_Init.exit + unreachable + +cc_Init.exit: ; preds = %subs_Init.exit + br label %bb.i.i375 + +bb.i.i375: ; preds = %bb.i.i375, %cc_Init.exit + br i1 undef, label %bb.i439, label %bb.i.i375 + +bb.i439: ; preds = %bb.i439, %bb.i.i375 + br i1 undef, label %opts_DeclareSPASSFlagsAsOptions.exit, label %bb.i439 + +opts_DeclareSPASSFlagsAsOptions.exit: ; preds = %bb.i439 + br i1 undef, label %opts_TranslateShortOptDeclarations.exit.i, label %bb.i.i82 + +bb.i.i82: ; preds = %opts_DeclareSPASSFlagsAsOptions.exit + unreachable + +opts_TranslateShortOptDeclarations.exit.i: ; preds = %opts_DeclareSPASSFlagsAsOptions.exit + br i1 undef, label %list_Length.exit.i.thread.i, label %bb.i.i4.i + +list_Length.exit.i.thread.i: ; preds = %opts_TranslateShortOptDeclarations.exit.i + br i1 undef, label %bb18.i.i.i, label %bb26.i.i.i + +bb.i.i4.i: ; preds = %opts_TranslateShortOptDeclarations.exit.i + unreachable + +bb18.i.i.i: ; preds = %list_Length.exit.i.thread.i + unreachable + +bb26.i.i.i: ; preds = %list_Length.exit.i.thread.i + br i1 undef, label %bb27.i142, label %opts_GetOptLongOnly.exit.thread97.i + +opts_GetOptLongOnly.exit.thread97.i: ; preds = %bb26.i.i.i + br label %bb27.i142 + +bb27.i142: ; preds = %opts_GetOptLongOnly.exit.thread97.i, %bb26.i.i.i + br label %bb1.i3.i + +bb1.i3.i: ; preds = %bb1.i3.i, %bb27.i142 + br i1 undef, label %opts_FreeLongOptsArray.exit.i, label %bb1.i3.i + +opts_FreeLongOptsArray.exit.i: ; preds = %bb1.i3.i + br label %bb.i443 + +bb.i443: ; preds = %bb.i443, %opts_FreeLongOptsArray.exit.i + br i1 undef, label %flag_InitStoreByDefaults3542.exit, label %bb.i443 + +flag_InitStoreByDefaults3542.exit: ; preds = %bb.i443 + br i1 undef, label %bb6.i449, label %bb.i503 + +bb6.i449: ; preds = %flag_InitStoreByDefaults3542.exit + unreachable + +bb.i503: ; preds = %bb.i503, %flag_InitStoreByDefaults3542.exit + br i1 undef, label %flag_CleanStore3464.exit, label %bb.i503 + +flag_CleanStore3464.exit: ; preds = %bb.i503 + br i1 undef, label %bb1.i81.i.preheader, label %bb.i173 + +bb.i173: ; preds = %flag_CleanStore3464.exit + unreachable + +bb1.i81.i.preheader: ; preds = %flag_CleanStore3464.exit + br i1 undef, label %bb1.i64.i.preheader, label %bb5.i179 + +bb5.i179: ; preds = %bb1.i81.i.preheader + unreachable + +bb1.i64.i.preheader: ; preds = %bb1.i81.i.preheader + br i1 undef, label %dfg_DeleteProofList.exit.i, label %bb.i9.i + +bb.i9.i: ; preds = %bb1.i64.i.preheader + unreachable + +dfg_DeleteProofList.exit.i: ; preds = %bb1.i64.i.preheader + br i1 undef, label %term_DeleteTermList621.exit.i, label %bb.i.i62.i + +bb.i.i62.i: ; preds = %bb.i.i62.i, %dfg_DeleteProofList.exit.i + br i1 undef, label %term_DeleteTermList621.exit.i, label %bb.i.i62.i + +term_DeleteTermList621.exit.i: ; preds = %bb.i.i62.i, %dfg_DeleteProofList.exit.i + br i1 undef, label %dfg_DFGParser.exit, label %bb.i.i211 + +bb.i.i211: ; preds = %term_DeleteTermList621.exit.i + unreachable + +dfg_DFGParser.exit: ; preds = %term_DeleteTermList621.exit.i + br label %bb.i513 + +bb.i513: ; preds = %bb2.i516, %dfg_DFGParser.exit + br i1 undef, label %bb2.i516, label %bb1.i514 + +bb1.i514: ; preds = %bb.i513 + unreachable + +bb2.i516: ; preds = %bb.i513 + br i1 undef, label %bb.i509, label %bb.i513 + +bb.i509: ; preds = %bb.i509, %bb2.i516 + br i1 undef, label %symbol_TransferPrecedence3468.exit511, label %bb.i509 + +symbol_TransferPrecedence3468.exit511: ; preds = %bb.i509 + br i1 undef, label %bb20, label %bb21 + +bb20: ; preds = %symbol_TransferPrecedence3468.exit511 + unreachable + +bb21: ; preds = %symbol_TransferPrecedence3468.exit511 + br i1 undef, label %cnf_Init.exit, label %bb.i498 + +bb.i498: ; preds = %bb21 + unreachable + +cnf_Init.exit: ; preds = %bb21 + br i1 undef, label %bb23, label %bb22 + +bb22: ; preds = %cnf_Init.exit + br i1 undef, label %bb2.i.i496, label %bb.i.i494 + +bb.i.i494: ; preds = %bb22 + unreachable + +bb2.i.i496: ; preds = %bb22 + unreachable + +bb23: ; preds = %cnf_Init.exit + br i1 undef, label %bb28, label %bb24 + +bb24: ; preds = %bb23 + unreachable + +bb28: ; preds = %bb23 + br i1 undef, label %bb31, label %bb29 + +bb29: ; preds = %bb28 + unreachable + +bb31: ; preds = %bb28 + br i1 undef, label %bb34, label %bb32 + +bb32: ; preds = %bb31 + unreachable + +bb34: ; preds = %bb31 + br i1 undef, label %bb83, label %bb66 + +bb66: ; preds = %bb34 + unreachable + +bb83: ; preds = %bb34 + br i1 undef, label %bb2.i1668, label %bb.i1667 + +bb.i1667: ; preds = %bb83 + unreachable + +bb2.i1668: ; preds = %bb83 + br i1 undef, label %bb5.i205, label %bb3.i204 + +bb3.i204: ; preds = %bb2.i1668 + unreachable + +bb5.i205: ; preds = %bb2.i1668 + br i1 undef, label %bb.i206.i, label %ana_AnalyzeSortStructure.exit.i + +bb.i206.i: ; preds = %bb5.i205 + br i1 undef, label %bb1.i207.i, label %ana_AnalyzeSortStructure.exit.i + +bb1.i207.i: ; preds = %bb.i206.i + br i1 undef, label %bb25.i1801.thread, label %bb.i1688 + +bb.i1688: ; preds = %bb1.i207.i + unreachable + +bb25.i1801.thread: ; preds = %bb1.i207.i + unreachable + +ana_AnalyzeSortStructure.exit.i: ; preds = %bb.i206.i, %bb5.i205 + br i1 undef, label %bb7.i207, label %bb.i1806 + +bb.i1806: ; preds = %ana_AnalyzeSortStructure.exit.i + br i1 undef, label %bb2.i.i.i1811, label %bb.i.i.i1809 + +bb.i.i.i1809: ; preds = %bb.i1806 + unreachable + +bb2.i.i.i1811: ; preds = %bb.i1806 + unreachable + +bb7.i207: ; preds = %ana_AnalyzeSortStructure.exit.i + br i1 undef, label %bb9.i, label %bb8.i + +bb8.i: ; preds = %bb7.i207 + unreachable + +bb9.i: ; preds = %bb7.i207 + br i1 undef, label %bb23.i, label %bb26.i + +bb23.i: ; preds = %bb9.i + br i1 undef, label %bb25.i, label %bb24.i + +bb24.i: ; preds = %bb23.i + br i1 undef, label %sort_SortTheoryIsTrivial.exit.i, label %bb.i2093 + +bb.i2093: ; preds = %bb.i2093, %bb24.i + br label %bb.i2093 + +sort_SortTheoryIsTrivial.exit.i: ; preds = %bb24.i + br i1 undef, label %bb3.i2141, label %bb4.i2143 + +bb3.i2141: ; preds = %sort_SortTheoryIsTrivial.exit.i + unreachable + +bb4.i2143: ; preds = %sort_SortTheoryIsTrivial.exit.i + br i1 undef, label %bb8.i2178, label %bb5.i2144 + +bb5.i2144: ; preds = %bb4.i2143 + br i1 undef, label %bb7.i2177, label %bb1.i28.i + +bb1.i28.i: ; preds = %bb5.i2144 + br i1 undef, label %bb4.i43.i, label %bb2.i.i2153 + +bb2.i.i2153: ; preds = %bb1.i28.i + br i1 undef, label %bb4.i.i33.i, label %bb.i.i30.i + +bb.i.i30.i: ; preds = %bb2.i.i2153 + unreachable + +bb4.i.i33.i: ; preds = %bb2.i.i2153 + br i1 undef, label %bb9.i.i36.i, label %bb5.i.i34.i + +bb5.i.i34.i: ; preds = %bb4.i.i33.i + unreachable + +bb9.i.i36.i: ; preds = %bb4.i.i33.i + br i1 undef, label %bb14.i.i.i2163, label %bb10.i.i37.i + +bb10.i.i37.i: ; preds = %bb9.i.i36.i + unreachable + +bb14.i.i.i2163: ; preds = %bb9.i.i36.i + br i1 undef, label %sort_LinkPrint.exit.i.i, label %bb15.i.i.i2164 + +bb15.i.i.i2164: ; preds = %bb14.i.i.i2163 + unreachable + +sort_LinkPrint.exit.i.i: ; preds = %bb14.i.i.i2163 + unreachable + +bb4.i43.i: ; preds = %bb1.i28.i + unreachable + +bb7.i2177: ; preds = %bb5.i2144 + unreachable + +bb8.i2178: ; preds = %bb4.i2143 + br i1 undef, label %sort_ApproxStaticSortTheory.exit, label %bb.i5.i2185.preheader + +bb.i5.i2185.preheader: ; preds = %bb8.i2178 + br label %bb.i5.i2185 + +bb.i5.i2185: ; preds = %bb.i5.i2185, %bb.i5.i2185.preheader + br i1 undef, label %sort_ApproxStaticSortTheory.exit, label %bb.i5.i2185 + +sort_ApproxStaticSortTheory.exit: ; preds = %bb.i5.i2185, %bb8.i2178 + br label %bb25.i + +bb25.i: ; preds = %sort_ApproxStaticSortTheory.exit, %bb23.i + unreachable + +bb26.i: ; preds = %bb9.i + unreachable +} diff --git a/test/CodeGen/ARM/2009-06-18-ThumbCommuteMul.ll b/test/CodeGen/ARM/2009-06-18-ThumbCommuteMul.ll new file mode 100644 index 0000000..9b2aba9 --- /dev/null +++ b/test/CodeGen/ARM/2009-06-18-ThumbCommuteMul.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -march=thumb | grep r0 | count 1 + +define i32 @a(i32 %x, i32 %y) nounwind readnone { +entry: + %mul = mul i32 %y, %x ; <i32> [#uses=1] + ret i32 %mul +} + diff --git a/test/CodeGen/ARM/2009-06-19-RegScavengerAssert.ll b/test/CodeGen/ARM/2009-06-19-RegScavengerAssert.ll new file mode 100644 index 0000000..cbe2385 --- /dev/null +++ b/test/CodeGen/ARM/2009-06-19-RegScavengerAssert.ll @@ -0,0 +1,30 @@ +; RUN: llvm-as < %s | llc -mtriple=armv6-eabi -mattr=+vfp2 -float-abi=hard +; PR4419 + +define float @__ieee754_acosf(float %x) nounwind { +entry: + br i1 undef, label %bb, label %bb4 + +bb: ; preds = %entry + ret float undef + +bb4: ; preds = %entry + br i1 undef, label %bb5, label %bb6 + +bb5: ; preds = %bb4 + ret float undef + +bb6: ; preds = %bb4 + br i1 undef, label %bb11, label %bb12 + +bb11: ; preds = %bb6 + %0 = tail call float @__ieee754_sqrtf(float undef) nounwind ; <float> [#uses=1] + %1 = fmul float %0, -2.000000e+00 ; <float> [#uses=1] + %2 = fadd float %1, 0x400921FB40000000 ; <float> [#uses=1] + ret float %2 + +bb12: ; preds = %bb6 + ret float undef +} + +declare float @__ieee754_sqrtf(float) diff --git a/test/CodeGen/ARM/ifcvt9.ll b/test/CodeGen/ARM/ifcvt9.ll new file mode 100644 index 0000000..bbd2f2e --- /dev/null +++ b/test/CodeGen/ARM/ifcvt9.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llc -march=arm + +define fastcc void @t() nounwind { +entry: + br i1 undef, label %bb.i.i3, label %growMapping.exit + +bb.i.i3: ; preds = %entry + unreachable + +growMapping.exit: ; preds = %entry + unreachable +} diff --git a/test/CodeGen/ARM/ldrd.ll b/test/CodeGen/ARM/ldrd.ll new file mode 100644 index 0000000..f1bee05 --- /dev/null +++ b/test/CodeGen/ARM/ldrd.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -mtriple=armv6-apple-darwin | grep ldrd +; RUN: llvm-as < %s | llc -mtriple=armv5-apple-darwin | not grep ldrd +; RUN: llvm-as < %s | llc -mtriple=armv6-eabi | not grep ldrd +; rdar://r6949835 + +@b = external global i64* + +define i64 @t(i64 %a) nounwind readonly { +entry: + %0 = load i64** @b, align 4 + %1 = load i64* %0, align 4 + %2 = mul i64 %1, %a + ret i64 %2 +} diff --git a/test/CodeGen/ARM/stm.ll b/test/CodeGen/ARM/stm.ll index 585645b..ed5e4c5 100644 --- a/test/CodeGen/ARM/stm.ll +++ b/test/CodeGen/ARM/stm.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -mattr=+v6,+vfp2 -arm-pre-alloc-loadstore-opti | grep stm | count 2 +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -mattr=+v6,+vfp2 | grep stm | count 2 @"\01LC" = internal constant [32 x i8] c"Boolean Not: %d %d %d %d %d %d\0A\00", section "__TEXT,__cstring,cstring_literals" ; <[32 x i8]*> [#uses=1] @"\01LC1" = internal constant [26 x i8] c"Bitwise Not: %d %d %d %d\0A\00", section "__TEXT,__cstring,cstring_literals" ; <[26 x i8]*> [#uses=1] diff --git a/test/CodeGen/ARM/thumb2-add.ll b/test/CodeGen/ARM/thumb2-add.ll new file mode 100644 index 0000000..d4f408f --- /dev/null +++ b/test/CodeGen/ARM/thumb2-add.ll @@ -0,0 +1,50 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add | grep #255 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add | grep #256 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add | grep #257 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add | grep #4094 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add | grep #4095 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add | grep #4096 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep add | grep lsl | grep #8 + +define i32 @t2ADDrc_255(i32 %lhs) { + %Rd = add i32 %lhs, 255; + ret i32 %Rd +} + +define i32 @t2ADDrc_256(i32 %lhs) { + %Rd = add i32 %lhs, 256; + ret i32 %Rd +} + +define i32 @t2ADDrc_257(i32 %lhs) { + %Rd = add i32 %lhs, 257; + ret i32 %Rd +} + +define i32 @t2ADDrc_4094(i32 %lhs) { + %Rd = add i32 %lhs, 4094; + ret i32 %Rd +} + +define i32 @t2ADDrc_4095(i32 %lhs) { + %Rd = add i32 %lhs, 4095; + ret i32 %Rd +} + +define i32 @t2ADDrc_4096(i32 %lhs) { + %Rd = add i32 %lhs, 4096; + ret i32 %Rd +} + +define i32 @t2ADDrr(i32 %lhs, i32 %rhs) { + %Rd = add i32 %lhs, %rhs; + ret i32 %Rd +} + +define i32 @t2ADDrs(i32 %lhs, i32 %rhs) { + %tmp = shl i32 %rhs, 8 + %Rd = add i32 %lhs, %tmp; + ret i32 %Rd +} + diff --git a/test/CodeGen/ARM/thumb2-mov.ll b/test/CodeGen/ARM/thumb2-mov.ll new file mode 100644 index 0000000..0c4c596 --- /dev/null +++ b/test/CodeGen/ARM/thumb2-mov.ll @@ -0,0 +1,127 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #11206827 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #2868947712 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #2880154539 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #251658240 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #3948544 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #258 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #4026531840 + +; Test #<const> + +; var 2.1 - 0x00ab00ab +define i32 @t2_const_var2_1_ok_1(i32 %lhs) { + %ret = add i32 %lhs, 11206827 ; 0x00ab00ab + ret i32 %ret +} + +define i32 @t2_const_var2_1_fail_1(i32 %lhs) { + %ret = add i32 %lhs, 11206843 ; 0x00ab00bb + ret i32 %ret +} + +define i32 @t2_const_var2_1_fail_2(i32 %lhs) { + %ret = add i32 %lhs, 27984043 ; 0x01ab00ab + ret i32 %ret +} + +define i32 @t2_const_var2_1_fail_3(i32 %lhs) { + %ret = add i32 %lhs, 27984299 ; 0x01ab01ab + ret i32 %ret +} + +define i32 @t2_const_var2_1_fail_4(i32 %lhs) { + %ret = add i32 %lhs, 28027649 ; 0x01abab01 + ret i32 %ret +} + +; var 2.2 - 0xab00ab00 +define i32 @t2_const_var2_2_ok_1(i32 %lhs) { + %ret = add i32 %lhs, 2868947712 ; 0xab00ab00 + ret i32 %ret +} + +define i32 @t2_const_var2_2_fail_1(i32 %lhs) { + %ret = add i32 %lhs, 2868951552 ; 0xab00ba00 + ret i32 %ret +} + +define i32 @t2_const_var2_2_fail_2(i32 %lhs) { + %ret = add i32 %lhs, 2868947728 ; 0xab00ab10 + ret i32 %ret +} + +define i32 @t2_const_var2_2_fail_3(i32 %lhs) { + %ret = add i32 %lhs, 2869996304 ; 0xab10ab10 + ret i32 %ret +} + +define i32 @t2_const_var2_2_fail_4(i32 %lhs) { + %ret = add i32 %lhs, 279685904 ; 0x10abab10 + ret i32 %ret +} + +; var 2.3 - 0xabababab +define i32 @t2_const_var2_3_ok_1(i32 %lhs) { + %ret = add i32 %lhs, 2880154539 ; 0xabababab + ret i32 %ret +} + +define i32 @t2_const_var2_3_fail_1(i32 %lhs) { + %ret = add i32 %lhs, 2880154554 ; 0xabababba + ret i32 %ret +} + +define i32 @t2_const_var2_3_fail_2(i32 %lhs) { + %ret = add i32 %lhs, 2880158379 ; 0xababbaab + ret i32 %ret +} + +define i32 @t2_const_var2_3_fail_3(i32 %lhs) { + %ret = add i32 %lhs, 2881137579 ; 0xabbaabab + ret i32 %ret +} + +define i32 @t2_const_var2_3_fail_4(i32 %lhs) { + %ret = add i32 %lhs, 3131812779 ; 0xbaababab + ret i32 %ret +} + +; var 3 - 0x0F000000 +define i32 @t2_const_var3_1_ok_1(i32 %lhs) { + %ret = add i32 %lhs, 251658240 ; 0x0F000000 + ret i32 %ret +} + +define i32 @t2_const_var3_2_ok_1(i32 %lhs) { + %ret = add i32 %lhs, 3948544 ; 0b00000000001111000100000000000000 + ret i32 %ret +} + +define i32 @t2_const_var3_2_fail_1(i32 %lhs) { + %ret = add i32 %lhs, 3940352 ; 0b00000000001111000010000000000000 + ret i32 %ret +} + +define i32 @t2_const_var3_3_ok_1(i32 %lhs) { + %ret = add i32 %lhs, 258 ; 0b00000000000000000000000100000010 + ret i32 %ret +} + +define i32 @t2_const_var3_4_ok_1(i32 %lhs) { + %ret = add i32 %lhs, 4026531840 ; 0xF0000000 + ret i32 %ret +} + diff --git a/test/CodeGen/ARM/thumb2-mov2.ll b/test/CodeGen/ARM/thumb2-mov2.ll new file mode 100644 index 0000000..d2f8c0b --- /dev/null +++ b/test/CodeGen/ARM/thumb2-mov2.ll @@ -0,0 +1,65 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt + +define i32 @t2MOVTi16_ok_1(i32 %a) { + %1 = and i32 %a, 65535 + %2 = shl i32 1234, 16 + %3 = or i32 %1, %2 + + ret i32 %3 +} + +define i32 @t2MOVTi16_test_1(i32 %a) { + %1 = shl i32 255, 8 + %2 = shl i32 1234, 8 + %3 = or i32 %1, 255 ; This give us 0xFFFF in %3 + %4 = shl i32 %2, 8 ; This gives us (1234 << 16) in %4 + %5 = and i32 %a, %3 + %6 = or i32 %4, %5 + + ret i32 %6 +} + +define i32 @t2MOVTi16_test_2(i32 %a) { + %1 = shl i32 255, 8 + %2 = shl i32 1234, 8 + %3 = or i32 %1, 255 ; This give us 0xFFFF in %3 + %4 = shl i32 %2, 6 + %5 = and i32 %a, %3 + %6 = shl i32 %4, 2 ; This gives us (1234 << 16) in %6 + %7 = or i32 %5, %6 + + ret i32 %7 +} + +define i32 @t2MOVTi16_test_3(i32 %a) { + %1 = shl i32 255, 8 + %2 = shl i32 1234, 8 + %3 = or i32 %1, 255 ; This give us 0xFFFF in %3 + %4 = shl i32 %2, 6 + %5 = and i32 %a, %3 + %6 = shl i32 %4, 2 ; This gives us (1234 << 16) in %6 + %7 = lshr i32 %6, 6 + %8 = shl i32 %7, 6 + %9 = or i32 %5, %8 + + ret i32 %9 +} + +define i32 @t2MOVTi16_test_nomatch_1(i32 %a) { + %1 = shl i32 255, 8 + %2 = shl i32 1234, 8 + %3 = or i32 %1, 255 ; This give us 0xFFFF in %3 + %4 = shl i32 %2, 6 + %5 = and i32 %a, %3 + %6 = shl i32 %4, 2 ; This gives us (1234 << 16) in %6 + %7 = lshr i32 %6, 3 + %8 = or i32 %5, %7 + + ret i32 %8 +} + + diff --git a/test/CodeGen/ARM/thumb2-shifter.ll b/test/CodeGen/ARM/thumb2-shifter.ll new file mode 100644 index 0000000..f9ec506 --- /dev/null +++ b/test/CodeGen/ARM/thumb2-shifter.ll @@ -0,0 +1,40 @@ +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsl +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep asr +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ror +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov + +define i32 @t2ADDrs_lsl(i32 %X, i32 %Y) { + %A = shl i32 %Y, 16 + %B = add i32 %X, %A + ret i32 %B +} + +define i32 @t2ADDrs_lsr(i32 %X, i32 %Y) { + %A = lshr i32 %Y, 16 + %B = add i32 %X, %A + ret i32 %B +} + +define i32 @t2ADDrs_asr(i32 %X, i32 %Y) { + %A = ashr i32 %Y, 16 + %B = add i32 %X, %A + ret i32 %B +} + +; i32 ror(n) = (x >> n) | (x << (32 - n)) +define i32 @t2ADDrs_ror(i32 %X, i32 %Y) { + %A = lshr i32 %Y, 16 + %B = shl i32 %Y, 16 + %C = or i32 %B, %A + %R = add i32 %X, %C + ret i32 %R +} + +define i32 @t2ADDrs_noRegShift(i32 %X, i32 %Y, i8 %sh) { + %shift.upgrd.1 = zext i8 %sh to i32 + %A = shl i32 %Y, %shift.upgrd.1 + %B = add i32 %X, %A + ret i32 %B +} + diff --git a/test/CodeGen/ARM/vargs2.ll b/test/CodeGen/ARM/vargs2.ll index fb0b8d8..5cc86a9 100644 --- a/test/CodeGen/ARM/vargs2.ll +++ b/test/CodeGen/ARM/vargs2.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | llc -march=thumb -; RUN: llvm-as < %s | llc -march=thumb | \ -; RUN: grep pop | count 2 +; RUN: llvm-as < %s | llc -mtriple=arm-linux -march=thumb | grep pop | count 1 +; RUN: llvm-as < %s | llc -mtriple=arm-darwin -march=thumb | grep pop | count 2 @str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] diff --git a/test/CodeGen/CellSPU/mul-with-overflow.ll b/test/CodeGen/CellSPU/mul-with-overflow.ll new file mode 100644 index 0000000..755b99b --- /dev/null +++ b/test/CodeGen/CellSPU/mul-with-overflow.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=cellspu + +declare {i16, i1} @llvm.smul.with.overflow.i16(i16 %a, i16 %b) +define i1 @a(i16 %x) zeroext nounwind { + %res = call {i16, i1} @llvm.smul.with.overflow.i16(i16 %x, i16 3) + %obil = extractvalue {i16, i1} %res, 1 + ret i1 %obil +} + +declare {i16, i1} @llvm.umul.with.overflow.i16(i16 %a, i16 %b) +define i1 @b(i16 %x) zeroext nounwind { + %res = call {i16, i1} @llvm.umul.with.overflow.i16(i16 %x, i16 3) + %obil = extractvalue {i16, i1} %res, 1 + ret i1 %obil +} diff --git a/test/CodeGen/PowerPC/mul-with-overflow.ll b/test/CodeGen/PowerPC/mul-with-overflow.ll new file mode 100644 index 0000000..0276846 --- /dev/null +++ b/test/CodeGen/PowerPC/mul-with-overflow.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=ppc32 + +declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b) +define i1 @a(i32 %x) zeroext nounwind { + %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3) + %obil = extractvalue {i32, i1} %res, 1 + ret i1 %obil +} + +declare {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b) +define i1 @b(i32 %x) zeroext nounwind { + %res = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %x, i32 3) + %obil = extractvalue {i32, i1} %res, 1 + ret i1 %obil +} diff --git a/test/CodeGen/X86/2009-06-15-not-a-tail-call.ll b/test/CodeGen/X86/2009-06-15-not-a-tail-call.ll new file mode 100644 index 0000000..095e6a1 --- /dev/null +++ b/test/CodeGen/X86/2009-06-15-not-a-tail-call.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | not grep TAILCALL + +; Bug 4396. This tail call can NOT be optimized. + +declare fastcc i8* @_D3gcx2GC12mallocNoSyncMFmkZPv() nounwind + +define fastcc i8* @_D3gcx2GC12callocNoSyncMFmkZPv() nounwind { +entry: + %tmp6 = tail call fastcc i8* @_D3gcx2GC12mallocNoSyncMFmkZPv() ; <i8*> [#uses=2] + %tmp9 = tail call i8* @memset(i8* %tmp6, i32 0, i64 2) ; <i8*> [#uses=0] + ret i8* %tmp6 +} + +declare i8* @memset(i8*, i32, i64) diff --git a/test/CodeGen/X86/2009-06-18-movlp-shuffle-register.ll b/test/CodeGen/X86/2009-06-18-movlp-shuffle-register.ll new file mode 100644 index 0000000..d6ff5b6 --- /dev/null +++ b/test/CodeGen/X86/2009-06-18-movlp-shuffle-register.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 +; PR2484 + +define <4 x float> @f4523(<4 x float> %a,<4 x float> %b) nounwind { +entry: +%shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 4,i32 +5,i32 2,i32 3> +ret <4 x float> %shuffle +} diff --git a/test/CodeGen/X86/fmul-zero.ll b/test/CodeGen/X86/fmul-zero.ll index 8f705a4..73aa713 100644 --- a/test/CodeGen/X86/fmul-zero.ll +++ b/test/CodeGen/X86/fmul-zero.ll @@ -3,7 +3,7 @@ define void @test14(<4 x float>*) nounwind { load <4 x float>* %0, align 1 - mul <4 x float> %2, zeroinitializer + fmul <4 x float> %2, zeroinitializer store <4 x float> %3, <4 x float>* %0, align 1 ret void } diff --git a/test/CodeGen/X86/inline-asm-fpstack2.ll b/test/CodeGen/X86/inline-asm-fpstack2.ll new file mode 100644 index 0000000..9685618 --- /dev/null +++ b/test/CodeGen/X86/inline-asm-fpstack2.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llc -march=x86 > %t +; RUN: grep {fld %%st(0)} %t +; PR4185 + +define void @test() { +return: + call void asm sideeffect "fistpl $0", "{st}"(double 1.000000e+06) + call void asm sideeffect "fistpl $0", "{st}"(double 1.000000e+06) + ret void +} diff --git a/test/CodeGen/X86/iv-users-in-other-loops.ll b/test/CodeGen/X86/iv-users-in-other-loops.ll index 2208b2d..a48f061 100644 --- a/test/CodeGen/X86/iv-users-in-other-loops.ll +++ b/test/CodeGen/X86/iv-users-in-other-loops.ll @@ -1,11 +1,11 @@ ; RUN: llvm-as < %s | llc -march=x86-64 -f -o %t ; RUN: grep inc %t | count 1 ; RUN: grep dec %t | count 2 -; RUN: grep addq %t | count 8 -; RUN: grep addb %t | count 2 -; RUN: grep leaq %t | count 12 -; RUN: grep leal %t | count 2 -; RUN: grep movq %t | count 4 +; RUN: grep addq %t | count 13 +; RUN: not grep addb %t +; RUN: grep leaq %t | count 8 +; RUN: grep leal %t | count 4 +; RUN: grep movq %t | count 5 ; IV users in each of the loops from other loops shouldn't cause LSR ; to insert new induction variables. Previously it would create a diff --git a/test/CodeGen/X86/optimize-smax.ll b/test/CodeGen/X86/optimize-max-0.ll index 0c3be31..90c1456 100644 --- a/test/CodeGen/X86/optimize-smax.ll +++ b/test/CodeGen/X86/optimize-max-0.ll @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86 | not grep cmov -; LSR should be able to eliminate the smax computations by -; making the loops use slt comparisons instead of ne comparisons. +; LSR should be able to eliminate the max computations by +; making the loops use slt/ult comparisons instead of ne comparisons. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9" @@ -231,6 +231,231 @@ return: ; preds = %bb20 ret void } +define void @bar(i8* %r, i32 %s, i32 %w, i32 %x, i8* %j, i32 %d) nounwind { +entry: + %0 = mul i32 %x, %w ; <i32> [#uses=2] + %1 = mul i32 %x, %w ; <i32> [#uses=1] + %2 = udiv i32 %1, 4 ; <i32> [#uses=1] + %.sum2 = add i32 %2, %0 ; <i32> [#uses=2] + %cond = icmp eq i32 %d, 1 ; <i1> [#uses=1] + br i1 %cond, label %bb29, label %bb10.preheader + +bb10.preheader: ; preds = %entry + %3 = icmp ne i32 %x, 0 ; <i1> [#uses=1] + br i1 %3, label %bb.nph9, label %bb18.loopexit + +bb.nph7: ; preds = %bb7.preheader + %4 = mul i32 %y.08, %w ; <i32> [#uses=1] + %5 = mul i32 %y.08, %s ; <i32> [#uses=1] + %6 = add i32 %5, 1 ; <i32> [#uses=1] + %tmp8 = icmp ugt i32 1, %w ; <i1> [#uses=1] + %smax9 = select i1 %tmp8, i32 1, i32 %w ; <i32> [#uses=1] + br label %bb6 + +bb6: ; preds = %bb7, %bb.nph7 + %x.06 = phi i32 [ 0, %bb.nph7 ], [ %indvar.next7, %bb7 ] ; <i32> [#uses=3] + %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] + store i8 %11, i8* %12, align 1 + br label %bb7 + +bb7: ; preds = %bb6 + %indvar.next7 = add i32 %x.06, 1 ; <i32> [#uses=2] + %exitcond10 = icmp ne i32 %indvar.next7, %smax9 ; <i1> [#uses=1] + br i1 %exitcond10, label %bb6, label %bb7.bb9_crit_edge + +bb7.bb9_crit_edge: ; preds = %bb7 + br label %bb9 + +bb9: ; preds = %bb7.preheader, %bb7.bb9_crit_edge + br label %bb10 + +bb10: ; preds = %bb9 + %indvar.next11 = add i32 %y.08, 1 ; <i32> [#uses=2] + %exitcond12 = icmp ne i32 %indvar.next11, %x ; <i1> [#uses=1] + br i1 %exitcond12, label %bb7.preheader, label %bb10.bb18.loopexit_crit_edge + +bb10.bb18.loopexit_crit_edge: ; preds = %bb10 + br label %bb10.bb18.loopexit_crit_edge.split + +bb10.bb18.loopexit_crit_edge.split: ; preds = %bb.nph9, %bb10.bb18.loopexit_crit_edge + br label %bb18.loopexit + +bb.nph9: ; preds = %bb10.preheader + %13 = icmp ugt i32 %w, 0 ; <i1> [#uses=1] + br i1 %13, label %bb.nph9.split, label %bb10.bb18.loopexit_crit_edge.split + +bb.nph9.split: ; preds = %bb.nph9 + br label %bb7.preheader + +bb7.preheader: ; preds = %bb.nph9.split, %bb10 + %y.08 = phi i32 [ 0, %bb.nph9.split ], [ %indvar.next11, %bb10 ] ; <i32> [#uses=3] + br i1 true, label %bb.nph7, label %bb9 + +bb.nph5: ; preds = %bb18.loopexit + %14 = udiv i32 %w, 2 ; <i32> [#uses=1] + %15 = icmp ult i32 %w, 2 ; <i1> [#uses=1] + %16 = udiv i32 %x, 2 ; <i32> [#uses=2] + br i1 %15, label %bb18.bb20_crit_edge.split, label %bb.nph5.split + +bb.nph5.split: ; preds = %bb.nph5 + %tmp2 = icmp ugt i32 1, %16 ; <i1> [#uses=1] + %smax3 = select i1 %tmp2, i32 1, i32 %16 ; <i32> [#uses=1] + br label %bb13 + +bb13: ; preds = %bb18, %bb.nph5.split + %y.14 = phi i32 [ 0, %bb.nph5.split ], [ %indvar.next1, %bb18 ] ; <i32> [#uses=4] + %17 = mul i32 %14, %y.14 ; <i32> [#uses=2] + %18 = shl i32 %y.14, 1 ; <i32> [#uses=1] + %19 = urem i32 %y.14, 2 ; <i32> [#uses=1] + %20 = add i32 %19, %18 ; <i32> [#uses=1] + %21 = mul i32 %20, %s ; <i32> [#uses=2] + br i1 true, label %bb.nph3, label %bb17 + +bb.nph3: ; preds = %bb13 + %22 = add i32 %17, %0 ; <i32> [#uses=1] + %23 = add i32 %17, %.sum2 ; <i32> [#uses=1] + %24 = udiv i32 %w, 2 ; <i32> [#uses=2] + %tmp = icmp ugt i32 1, %24 ; <i1> [#uses=1] + %smax = select i1 %tmp, i32 1, i32 %24 ; <i32> [#uses=1] + br label %bb14 + +bb14: ; preds = %bb15, %bb.nph3 + %x.12 = phi i32 [ 0, %bb.nph3 ], [ %indvar.next, %bb15 ] ; <i32> [#uses=5] + %25 = shl i32 %x.12, 2 ; <i32> [#uses=1] + %26 = add i32 %25, %21 ; <i32> [#uses=1] + %27 = getelementptr i8* %r, i32 %26 ; <i8*> [#uses=1] + %28 = load i8* %27, align 1 ; <i8> [#uses=1] + %.sum = add i32 %22, %x.12 ; <i32> [#uses=1] + %29 = getelementptr i8* %j, i32 %.sum ; <i8*> [#uses=1] + store i8 %28, i8* %29, align 1 + %30 = shl i32 %x.12, 2 ; <i32> [#uses=1] + %31 = or i32 %30, 2 ; <i32> [#uses=1] + %32 = add i32 %31, %21 ; <i32> [#uses=1] + %33 = getelementptr i8* %r, i32 %32 ; <i8*> [#uses=1] + %34 = load i8* %33, align 1 ; <i8> [#uses=1] + %.sum6 = add i32 %23, %x.12 ; <i32> [#uses=1] + %35 = getelementptr i8* %j, i32 %.sum6 ; <i8*> [#uses=1] + store i8 %34, i8* %35, align 1 + br label %bb15 + +bb15: ; preds = %bb14 + %indvar.next = add i32 %x.12, 1 ; <i32> [#uses=2] + %exitcond = icmp ne i32 %indvar.next, %smax ; <i1> [#uses=1] + br i1 %exitcond, label %bb14, label %bb15.bb17_crit_edge + +bb15.bb17_crit_edge: ; preds = %bb15 + br label %bb17 + +bb17: ; preds = %bb15.bb17_crit_edge, %bb13 + br label %bb18 + +bb18.loopexit: ; preds = %bb10.bb18.loopexit_crit_edge.split, %bb10.preheader + %36 = icmp ult i32 %x, 2 ; <i1> [#uses=1] + br i1 %36, label %bb20, label %bb.nph5 + +bb18: ; preds = %bb17 + %indvar.next1 = add i32 %y.14, 1 ; <i32> [#uses=2] + %exitcond4 = icmp ne i32 %indvar.next1, %smax3 ; <i1> [#uses=1] + br i1 %exitcond4, label %bb13, label %bb18.bb20_crit_edge + +bb18.bb20_crit_edge: ; preds = %bb18 + br label %bb18.bb20_crit_edge.split + +bb18.bb20_crit_edge.split: ; preds = %bb18.bb20_crit_edge, %bb.nph5 + br label %bb20 + +bb20: ; preds = %bb18.bb20_crit_edge.split, %bb18.loopexit + switch i32 %d, label %return [ + i32 3, label %bb22 + i32 1, label %bb29 + ] + +bb22: ; preds = %bb20 + %37 = mul i32 %x, %w ; <i32> [#uses=1] + %38 = udiv i32 %37, 4 ; <i32> [#uses=1] + %.sum3 = add i32 %38, %.sum2 ; <i32> [#uses=2] + %39 = add i32 %x, 15 ; <i32> [#uses=1] + %40 = and i32 %39, -16 ; <i32> [#uses=1] + %41 = add i32 %w, 15 ; <i32> [#uses=1] + %42 = and i32 %41, -16 ; <i32> [#uses=1] + %43 = mul i32 %40, %s ; <i32> [#uses=1] + %44 = icmp ugt i32 %x, 0 ; <i1> [#uses=1] + br i1 %44, label %bb.nph, label %bb26 + +bb.nph: ; preds = %bb22 + br label %bb23 + +bb23: ; preds = %bb24, %bb.nph + %y.21 = phi i32 [ 0, %bb.nph ], [ %indvar.next5, %bb24 ] ; <i32> [#uses=3] + %45 = mul i32 %y.21, %42 ; <i32> [#uses=1] + %.sum1 = add i32 %45, %43 ; <i32> [#uses=1] + %46 = getelementptr i8* %r, i32 %.sum1 ; <i8*> [#uses=1] + %47 = mul i32 %y.21, %w ; <i32> [#uses=1] + %.sum5 = add i32 %47, %.sum3 ; <i32> [#uses=1] + %48 = getelementptr i8* %j, i32 %.sum5 ; <i8*> [#uses=1] + tail call void @llvm.memcpy.i32(i8* %48, i8* %46, i32 %w, i32 1) + br label %bb24 + +bb24: ; preds = %bb23 + %indvar.next5 = add i32 %y.21, 1 ; <i32> [#uses=2] + %exitcond6 = icmp ne i32 %indvar.next5, %x ; <i1> [#uses=1] + br i1 %exitcond6, label %bb23, label %bb24.bb26_crit_edge + +bb24.bb26_crit_edge: ; preds = %bb24 + br label %bb26 + +bb26: ; preds = %bb24.bb26_crit_edge, %bb22 + %49 = mul i32 %x, %w ; <i32> [#uses=1] + %.sum4 = add i32 %.sum3, %49 ; <i32> [#uses=1] + %50 = getelementptr i8* %j, i32 %.sum4 ; <i8*> [#uses=1] + %51 = mul i32 %x, %w ; <i32> [#uses=1] + %52 = udiv i32 %51, 2 ; <i32> [#uses=1] + tail call void @llvm.memset.i32(i8* %50, i8 -128, i32 %52, i32 1) + ret void + +bb29: ; preds = %bb20, %entry + %53 = add i32 %w, 15 ; <i32> [#uses=1] + %54 = and i32 %53, -16 ; <i32> [#uses=1] + %55 = icmp ugt i32 %x, 0 ; <i1> [#uses=1] + br i1 %55, label %bb.nph11, label %bb33 + +bb.nph11: ; preds = %bb29 + br label %bb30 + +bb30: ; preds = %bb31, %bb.nph11 + %y.310 = phi i32 [ 0, %bb.nph11 ], [ %indvar.next13, %bb31 ] ; <i32> [#uses=3] + %56 = mul i32 %y.310, %54 ; <i32> [#uses=1] + %57 = getelementptr i8* %r, i32 %56 ; <i8*> [#uses=1] + %58 = mul i32 %y.310, %w ; <i32> [#uses=1] + %59 = getelementptr i8* %j, i32 %58 ; <i8*> [#uses=1] + tail call void @llvm.memcpy.i32(i8* %59, i8* %57, i32 %w, i32 1) + br label %bb31 + +bb31: ; preds = %bb30 + %indvar.next13 = add i32 %y.310, 1 ; <i32> [#uses=2] + %exitcond14 = icmp ne i32 %indvar.next13, %x ; <i1> [#uses=1] + br i1 %exitcond14, label %bb30, label %bb31.bb33_crit_edge + +bb31.bb33_crit_edge: ; preds = %bb31 + br label %bb33 + +bb33: ; preds = %bb31.bb33_crit_edge, %bb29 + %60 = mul i32 %x, %w ; <i32> [#uses=1] + %61 = getelementptr i8* %j, i32 %60 ; <i8*> [#uses=1] + %62 = mul i32 %x, %w ; <i32> [#uses=1] + %63 = udiv i32 %62, 2 ; <i32> [#uses=1] + tail call void @llvm.memset.i32(i8* %61, i8 -128, i32 %63, i32 1) + ret void + +return: ; preds = %bb20 + ret void +} + declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind diff --git a/test/CodeGen/X86/optimize-max-1.ll b/test/CodeGen/X86/optimize-max-1.ll new file mode 100644 index 0000000..084e181 --- /dev/null +++ b/test/CodeGen/X86/optimize-max-1.ll @@ -0,0 +1,78 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | not grep cmov + +; LSR should be able to eliminate both smax and umax expressions +; in loop trip counts. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" + +define void @fs(double* nocapture %p, i64 %n) nounwind { +entry: + %tmp = icmp slt i64 %n, 1 ; <i1> [#uses=1] + %smax = select i1 %tmp, i64 1, i64 %n ; <i64> [#uses=1] + br label %bb + +bb: ; preds = %bb, %entry + %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2] + %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1] + store double 0.000000e+00, double* %scevgep, align 8 + %0 = add i64 %i.0, 1 ; <i64> [#uses=2] + %exitcond = icmp eq i64 %0, %smax ; <i1> [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb + ret void +} + +define void @bs(double* nocapture %p, i64 %n) nounwind { +entry: + %tmp = icmp sge i64 %n, 1 ; <i1> [#uses=1] + %smax = select i1 %tmp, i64 %n, i64 1 ; <i64> [#uses=1] + br label %bb + +bb: ; preds = %bb, %entry + %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2] + %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1] + store double 0.000000e+00, double* %scevgep, align 8 + %0 = add i64 %i.0, 1 ; <i64> [#uses=2] + %exitcond = icmp eq i64 %0, %smax ; <i1> [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb + ret void +} + +define void @fu(double* nocapture %p, i64 %n) nounwind { +entry: + %tmp = icmp eq i64 %n, 0 ; <i1> [#uses=1] + %umax = select i1 %tmp, i64 1, i64 %n ; <i64> [#uses=1] + br label %bb + +bb: ; preds = %bb, %entry + %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2] + %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1] + store double 0.000000e+00, double* %scevgep, align 8 + %0 = add i64 %i.0, 1 ; <i64> [#uses=2] + %exitcond = icmp eq i64 %0, %umax ; <i1> [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb + ret void +} + +define void @bu(double* nocapture %p, i64 %n) nounwind { +entry: + %tmp = icmp ne i64 %n, 0 ; <i1> [#uses=1] + %umax = select i1 %tmp, i64 %n, i64 1 ; <i64> [#uses=1] + br label %bb + +bb: ; preds = %bb, %entry + %i.0 = phi i64 [ 0, %entry ], [ %0, %bb ] ; <i64> [#uses=2] + %scevgep = getelementptr double* %p, i64 %i.0 ; <double*> [#uses=1] + store double 0.000000e+00, double* %scevgep, align 8 + %0 = add i64 %i.0, 1 ; <i64> [#uses=2] + %exitcond = icmp eq i64 %0, %umax ; <i1> [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb + ret void +} diff --git a/test/CodeGen/X86/optimize-max-2.ll b/test/CodeGen/X86/optimize-max-2.ll new file mode 100644 index 0000000..effc3fc --- /dev/null +++ b/test/CodeGen/X86/optimize-max-2.ll @@ -0,0 +1,30 @@ +; RUN: llvm-as < %s | llc -march=x86-64 > %t +; RUN: grep cmov %t | count 2 +; RUN: grep jne %t | count 1 + +; LSR's OptimizeMax function shouldn't try to eliminate this max, because +; it has three operands. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" + +define void @foo(double* nocapture %p, i64 %x, i64 %y) nounwind { +entry: + %tmp = icmp eq i64 %y, 0 ; <i1> [#uses=1] + %umax = select i1 %tmp, i64 1, i64 %y ; <i64> [#uses=2] + %tmp8 = icmp ugt i64 %umax, %x ; <i1> [#uses=1] + %umax9 = select i1 %tmp8, i64 %umax, i64 %x ; <i64> [#uses=1] + br label %bb4 + +bb4: ; preds = %bb4, %entry + %i.07 = phi i64 [ 0, %entry ], [ %2, %bb4 ] ; <i64> [#uses=2] + %scevgep = getelementptr double* %p, i64 %i.07 ; <double*> [#uses=2] + %0 = load double* %scevgep, align 8 ; <double> [#uses=1] + %1 = fmul double %0, 2.000000e+00 ; <double> [#uses=1] + store double %1, double* %scevgep, align 8 + %2 = add i64 %i.07, 1 ; <i64> [#uses=2] + %exitcond = icmp eq i64 %2, %umax9 ; <i1> [#uses=1] + br i1 %exitcond, label %return, label %bb4 + +return: ; preds = %bb4 + ret void +} diff --git a/test/CodeGen/X86/pic_jumptable.ll b/test/CodeGen/X86/pic_jumptable.ll index 1731feb..229865b 100644 --- a/test/CodeGen/X86/pic_jumptable.ll +++ b/test/CodeGen/X86/pic_jumptable.ll @@ -1,6 +1,8 @@ ; RUN: llvm-as < %s | llc -relocation-model=pic -mtriple=i386-linux-gnu -asm-verbose=false | not grep -F .text ; RUN: llvm-as < %s | llc -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false | not grep lea ; RUN: llvm-as < %s | llc -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false | grep add | count 2 +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | not grep 'lJTI' +; rdar://6971437 declare void @_Z3bari(i32) diff --git a/test/CodeGen/X86/tls1-pic.ll b/test/CodeGen/X86/tls1-pic.ll index a73e75b..e43bf7c 100644 --- a/test/CodeGen/X86/tls1-pic.ll +++ b/test/CodeGen/X86/tls1-pic.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t -; RUN: grep {leal i@TLSGD(,%ebx,1), %eax} %t +; RUN: grep {leal i@TLSGD(,%ebx), %eax} %t ; RUN: grep {call ___tls_get_addr@PLT} %t ; RUN: llvm-as < %s | llc -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic > %t2 ; RUN: grep {leaq i@TLSGD(%rip), %rdi} %t2 diff --git a/test/CodeGen/X86/tls1.ll b/test/CodeGen/X86/tls1.ll index 5155dfd..85ff360 100644 --- a/test/CodeGen/X86/tls1.ll +++ b/test/CodeGen/X86/tls1.ll @@ -5,7 +5,7 @@ @i = thread_local global i32 15 -define i32 @f() { +define i32 @f() nounwind { entry: %tmp1 = load i32* @i ret i32 %tmp1 diff --git a/test/CodeGen/X86/tls2-pic.ll b/test/CodeGen/X86/tls2-pic.ll index cdfe97c..6ab3ee0 100644 --- a/test/CodeGen/X86/tls2-pic.ll +++ b/test/CodeGen/X86/tls2-pic.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t -; RUN: grep {leal i@TLSGD(,%ebx,1), %eax} %t +; RUN: grep {leal i@TLSGD(,%ebx), %eax} %t ; RUN: grep {call ___tls_get_addr@PLT} %t ; RUN: llvm-as < %s | llc -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic > %t2 ; RUN: grep {leaq i@TLSGD(%rip), %rdi} %t2 @@ -7,7 +7,7 @@ @i = thread_local global i32 15 -define i32* @f() { +define i32* @f() nounwind { entry: ret i32* @i } diff --git a/test/CodeGen/X86/tls3-pic.ll b/test/CodeGen/X86/tls3-pic.ll index f62cca2..8e6df29 100644 --- a/test/CodeGen/X86/tls3-pic.ll +++ b/test/CodeGen/X86/tls3-pic.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t -; RUN: grep {leal i@TLSGD(,%ebx,1), %eax} %t +; RUN: grep {leal i@TLSGD(,%ebx), %eax} %t ; RUN: grep {call ___tls_get_addr@PLT} %t ; RUN: llvm-as < %s | llc -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic > %t2 ; RUN: grep {leaq i@TLSGD(%rip), %rdi} %t2 diff --git a/test/CodeGen/X86/tls4-pic.ll b/test/CodeGen/X86/tls4-pic.ll index ec3d435..94de78f 100644 --- a/test/CodeGen/X86/tls4-pic.ll +++ b/test/CodeGen/X86/tls4-pic.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic > %t -; RUN: grep {leal i@TLSGD(,%ebx,1), %eax} %t +; RUN: grep {leal i@TLSGD(,%ebx), %eax} %t ; RUN: grep {call ___tls_get_addr@PLT} %t ; RUN: llvm-as < %s | llc -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic > %t2 ; RUN: grep {leaq i@TLSGD(%rip), %rdi} %t2 diff --git a/test/CodeGen/X86/umul-with-overflow.ll b/test/CodeGen/X86/umul-with-overflow.ll new file mode 100644 index 0000000..9e69154 --- /dev/null +++ b/test/CodeGen/X86/umul-with-overflow.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep "\\\\\\\<mul" + +declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b) +define i1 @a(i32 %x) zeroext nounwind { + %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3) + %obil = extractvalue {i32, i1} %res, 1 + ret i1 %obil +} diff --git a/test/DebugInfo/2009-06-15-InlineFuncStart.ll b/test/DebugInfo/2009-06-15-InlineFuncStart.ll new file mode 100644 index 0000000..2ece6a3 --- /dev/null +++ b/test/DebugInfo/2009-06-15-InlineFuncStart.ll @@ -0,0 +1,77 @@ +; Test inlined function handling. This test case is copied from +; 2009-06-12-InlineFunctStart.ll with one change. In function main, the bb1 +; does not have llvm.dbg.stoppiont intrinsic before llvm.dbg.func.start. +; RUN: llvm-as < %s | llc +; RUN: llvm-as < %s | llc -O0 + %llvm.dbg.anchor.type = type { i32, i32 } + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } +@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] +@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] +@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] +@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] +@.str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] +@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5627) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] +@.str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] +@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] +@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] +@llvm.dbg.subprogram5 = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@.str6 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] + +define i32 @foo() nounwind alwaysinline { +entry: + %retval = alloca i32 ; <i32*> [#uses=2] + %0 = alloca i32 ; <i32*> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + store i32 42, i32* %0, align 4 + %1 = load i32* %0, align 4 ; <i32> [#uses=1] + store i32 %1, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval1 = load i32* %retval ; <i32> [#uses=1] + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + ret i32 %retval1 +} + +declare void @llvm.dbg.func.start({ }*) nounwind + +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind + +declare void @llvm.dbg.region.end({ }*) nounwind + +define i32 @main() nounwind { +entry: + %retval.i = alloca i32 ; <i32*> [#uses=2] + %0 = alloca i32 ; <i32*> [#uses=2] + %retval = alloca i32 ; <i32*> [#uses=2] + %1 = alloca i32 ; <i32*> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram5 to { }*)) + br label %bb1 + +return: ; preds = %entry + %retval1 = load i32* %retval ; <i32> [#uses=1] + call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram5 to { }*)) + ret i32 %retval1 + +bb1: + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) nounwind + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind + store i32 42, i32* %0, align 4 + %2 = load i32* %0, align 4 ; <i32> [#uses=1] + store i32 %2, i32* %retval.i, align 4 + %retval1.i = load i32* %retval.i ; <i32> [#uses=1] + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) nounwind + store i32 %retval1.i, i32* %1, align 4 + %3 = load i32* %1, align 4 ; <i32> [#uses=1] + store i32 %3, i32* %retval, align 4 + br label %return +} diff --git a/test/DebugInfo/2009-06-15-abstract_origin.ll b/test/DebugInfo/2009-06-15-abstract_origin.ll new file mode 100644 index 0000000..3029da0 --- /dev/null +++ b/test/DebugInfo/2009-06-15-abstract_origin.ll @@ -0,0 +1,275 @@ +; RUN: llvm-as < %s | llc -asm-verbose -O0 | not grep ".long 0x0 ## DW_AT_abstract_origin" + + %llvm.dbg.anchor.type = type { i32, i32 } + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } + %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 } + %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* } + %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* } + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } + %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } + %struct.AAAAAImageParser = type { %struct.CObject* } + %struct.CObject = type { i32 } +@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] +@.str = internal constant [9 x i8] c"tcase.cc\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1] +@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1] +@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5646) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1] +@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([9 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] +@.str3 = internal constant [8 x i8] c"tcase.h\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] +@llvm.dbg.compile_unit4 = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] +@.str5 = internal constant [8 x i8] c"CObject\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] +@.str6 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] +@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] +@.str7 = internal constant [2 x i8] c"d\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] +@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str7, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 6, i64 32, i64 32, i64 0, i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@llvm.dbg.derivedtype8 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@llvm.dbg.array = internal constant [3 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype8 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] +@llvm.dbg.composite9 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] +@.str10 = internal constant [4 x i8] c"set\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] +@.str11 = internal constant [18 x i8] c"_ZN7CObject3setEi\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1] +@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str10, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str10, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str11, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 3, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite9 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.array12 = internal constant [2 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype8 to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] +@llvm.dbg.composite13 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array12 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@.str14 = internal constant [8 x i8] c"release\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] +@.str15 = internal constant [22 x i8] c"_ZN7CObject7releaseEv\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1] +@llvm.dbg.subprogram16 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([8 x i8]* @.str14, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str14, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str15, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 4, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite13 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.array17 = internal constant [3 x { }*] [{ }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to { }*)], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] +@llvm.dbg.composite18 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([8 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 1, i64 32, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array17 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@llvm.dbg.derivedtype19 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@llvm.dbg.array20 = internal constant [2 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] +@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array20 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@llvm.dbg.subprogram21 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([8 x i8]* @.str14, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str14, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str15, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 4, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.derivedtype22 = internal constant %llvm.dbg.derivedtype.type { i32 458790, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@.str23 = internal constant [5 x i8] c"this\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] +@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram21 to { }*), i8* getelementptr ([5 x i8]* @.str23, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 4, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype22 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] +@llvm.dbg.array24 = internal constant [2 x { }*] [{ }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] +@llvm.dbg.composite25 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array24 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@.str26 = internal constant [14 x i8] c"ReleaseObject\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1] +@.str27 = internal constant [27 x i8] c"_Z13ReleaseObjectP7CObject\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1] +@llvm.dbg.subprogram28 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([14 x i8]* @.str26, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str26, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str27, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 10, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite25 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@.str29 = internal constant [7 x i8] c"object\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] +@llvm.dbg.variable30 = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram28 to { }*), i8* getelementptr ([7 x i8]* @.str29, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 10, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype22 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] +@.str31 = internal constant [17 x i8] c"AAAAAImageParser\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1] +@.str33 = internal constant [13 x i8] c"mCustomWhite\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1] +@llvm.dbg.derivedtype34 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([13 x i8]* @.str33, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 21, i64 32, i64 32, i64 0, i32 1, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@llvm.dbg.derivedtype35 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite45 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@llvm.dbg.array36 = internal constant [3 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype35 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] +@llvm.dbg.composite37 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array36 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@.str38 = internal constant [18 x i8] c"~AAAAAImageParser\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1] +@llvm.dbg.subprogram39 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([18 x i8]* @.str38, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str38, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 24, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite37 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.array40 = internal constant [3 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype35 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*)], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] +@llvm.dbg.composite41 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array40 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@.str42 = internal constant [36 x i8] c"_ZN16AAAAAImageParser3setEP7CObject\00", section "llvm.metadata" ; <[36 x i8]*> [#uses=1] +@llvm.dbg.subprogram43 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str10, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str10, i32 0, i32 0), i8* getelementptr ([36 x i8]* @.str42, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 19, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite41 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.array44 = internal constant [3 x { }*] [{ }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype34 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram39 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram43 to { }*)], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] +@llvm.dbg.composite45 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([17 x i8]* @.str31, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 16, i64 32, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array44 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@llvm.dbg.derivedtype46 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite45 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@llvm.dbg.array47 = internal constant [2 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype46 to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] +@llvm.dbg.composite48 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array47 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@.str49 = internal constant [26 x i8] c"_ZN16AAAAAImageParserD2Ev\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1] +@llvm.dbg.subprogram50 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([18 x i8]* @.str38, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str38, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str49, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 24, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite48 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.derivedtype51 = internal constant %llvm.dbg.derivedtype.type { i32 458790, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype46 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] +@llvm.dbg.variable52 = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram50 to { }*), i8* getelementptr ([5 x i8]* @.str23, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 24, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype51 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] +@.str53 = internal constant [26 x i8] c"_ZN16AAAAAImageParserD1Ev\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1] +@llvm.dbg.subprogram54 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([18 x i8]* @.str38, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str38, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str53, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 24, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite48 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@llvm.dbg.variable55 = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram54 to { }*), i8* getelementptr ([5 x i8]* @.str23, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*), i32 24, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype51 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] +@llvm.dbg.array56 = internal constant [1 x { }*] [{ }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1] +@llvm.dbg.composite57 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([1 x { }*]* @llvm.dbg.array56 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] +@.str58 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] +@llvm.dbg.subprogram59 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str58, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str58, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str58, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite57 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] +@.str60 = internal constant [2 x i8] c"C\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] +@llvm.dbg.variable61 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram59 to { }*), i8* getelementptr ([2 x i8]* @.str60, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype46 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] +@_ZZ4mainE3C.0 = private constant %struct.AAAAAImageParser zeroinitializer ; <%struct.AAAAAImageParser*> [#uses=2] +@llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] +@.str62 = internal constant [14 x i8] c"_ZZ4mainE3C.0\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1] +@.str63 = internal constant [4 x i8] c"C.0\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] +@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 458804, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([14 x i8]* @.str62, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str63, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str62, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite45 to { }*), i1 false, i1 true, { }* bitcast (%struct.AAAAAImageParser* @_ZZ4mainE3C.0 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] + +define void @_ZN16AAAAAImageParserD2Ev(%struct.AAAAAImageParser* %this) nounwind ssp { +entry: + %object_addr.i = alloca %struct.CObject* ; <%struct.CObject**> [#uses=4] + %retval.i = alloca %struct.CObject* ; <%struct.CObject**> [#uses=2] + %0 = alloca %struct.CObject* ; <%struct.CObject**> [#uses=2] + %this_addr = alloca %struct.AAAAAImageParser* ; <%struct.AAAAAImageParser**> [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram50 to { }*)) + %1 = bitcast %struct.AAAAAImageParser** %this_addr to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable52 to { }*)) + store %struct.AAAAAImageParser* %this, %struct.AAAAAImageParser** %this_addr + call void @llvm.dbg.stoppoint(i32 26, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + %2 = load %struct.AAAAAImageParser** %this_addr, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + %3 = getelementptr %struct.AAAAAImageParser* %2, i32 0, i32 0 ; <%struct.CObject**> [#uses=1] + %4 = load %struct.CObject** %3, align 4 ; <%struct.CObject*> [#uses=1] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram28 to { }*)) nounwind + %5 = bitcast %struct.CObject** %object_addr.i to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %5, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable30 to { }*)) nounwind + store %struct.CObject* %4, %struct.CObject** %object_addr.i + call void @llvm.dbg.stoppoint(i32 11, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + %6 = load %struct.CObject** %object_addr.i, align 4 ; <%struct.CObject*> [#uses=1] + %7 = icmp ne %struct.CObject* %6, null ; <i1> [#uses=1] + br i1 %7, label %bb.i, label %_Z13ReleaseObjectP7CObject.exit + +bb.i: ; preds = %entry + call void @llvm.dbg.stoppoint(i32 12, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + %8 = load %struct.CObject** %object_addr.i, align 4 ; <%struct.CObject*> [#uses=1] + call void @_ZN7CObject7releaseEv(%struct.CObject* %8) nounwind + br label %_Z13ReleaseObjectP7CObject.exit + +_Z13ReleaseObjectP7CObject.exit: ; preds = %bb.i, %entry + call void @llvm.dbg.stoppoint(i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + store %struct.CObject* null, %struct.CObject** %0, align 4 + %9 = load %struct.CObject** %0, align 4 ; <%struct.CObject*> [#uses=1] + store %struct.CObject* %9, %struct.CObject** %retval.i, align 4 + %retval2.i = load %struct.CObject** %retval.i ; <%struct.CObject*> [#uses=0] + call void @llvm.dbg.stoppoint(i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + call void @llvm.dbg.stoppoint(i32 27, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram28 to { }*)) + br label %bb + +bb: ; preds = %_Z13ReleaseObjectP7CObject.exit + call void @llvm.dbg.stoppoint(i32 27, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + br label %return + +return: ; preds = %bb + call void @llvm.dbg.stoppoint(i32 27, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram50 to { }*)) + ret void +} + +define linkonce_odr void @_ZN7CObject7releaseEv(%struct.CObject* %this) nounwind ssp { +entry: + %this_addr = alloca %struct.CObject* ; <%struct.CObject**> [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram21 to { }*)) + %0 = bitcast %struct.CObject** %this_addr to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*)) + store %struct.CObject* %this, %struct.CObject** %this_addr + call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + %1 = load %struct.CObject** %this_addr, align 4 ; <%struct.CObject*> [#uses=1] + %2 = getelementptr %struct.CObject* %1, i32 0, i32 0 ; <i32*> [#uses=1] + store i32 0, i32* %2, align 4 + br label %return + +return: ; preds = %entry + call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram21 to { }*)) + ret void +} + +declare void @llvm.dbg.func.start({ }*) nounwind readnone + +declare void @llvm.dbg.declare({ }*, { }*) nounwind readnone + +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind readnone + +declare void @llvm.dbg.region.end({ }*) nounwind readnone + +define void @_ZN16AAAAAImageParserD1Ev(%struct.AAAAAImageParser* %this) nounwind ssp { +entry: + %object_addr.i = alloca %struct.CObject* ; <%struct.CObject**> [#uses=4] + %retval.i = alloca %struct.CObject* ; <%struct.CObject**> [#uses=2] + %0 = alloca %struct.CObject* ; <%struct.CObject**> [#uses=2] + %this_addr = alloca %struct.AAAAAImageParser* ; <%struct.AAAAAImageParser**> [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram54 to { }*)) + %1 = bitcast %struct.AAAAAImageParser** %this_addr to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable55 to { }*)) + store %struct.AAAAAImageParser* %this, %struct.AAAAAImageParser** %this_addr + call void @llvm.dbg.stoppoint(i32 26, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + %2 = load %struct.AAAAAImageParser** %this_addr, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + %3 = getelementptr %struct.AAAAAImageParser* %2, i32 0, i32 0 ; <%struct.CObject**> [#uses=1] + %4 = load %struct.CObject** %3, align 4 ; <%struct.CObject*> [#uses=1] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram28 to { }*)) nounwind + %5 = bitcast %struct.CObject** %object_addr.i to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %5, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable30 to { }*)) nounwind + store %struct.CObject* %4, %struct.CObject** %object_addr.i + call void @llvm.dbg.stoppoint(i32 11, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + %6 = load %struct.CObject** %object_addr.i, align 4 ; <%struct.CObject*> [#uses=1] + %7 = icmp ne %struct.CObject* %6, null ; <i1> [#uses=1] + br i1 %7, label %bb.i, label %_Z13ReleaseObjectP7CObject.exit + +bb.i: ; preds = %entry + call void @llvm.dbg.stoppoint(i32 12, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + %8 = load %struct.CObject** %object_addr.i, align 4 ; <%struct.CObject*> [#uses=1] + call void @_ZN7CObject7releaseEv(%struct.CObject* %8) nounwind + br label %_Z13ReleaseObjectP7CObject.exit + +_Z13ReleaseObjectP7CObject.exit: ; preds = %bb.i, %entry + call void @llvm.dbg.stoppoint(i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + store %struct.CObject* null, %struct.CObject** %0, align 4 + %9 = load %struct.CObject** %0, align 4 ; <%struct.CObject*> [#uses=1] + store %struct.CObject* %9, %struct.CObject** %retval.i, align 4 + %retval2.i = load %struct.CObject** %retval.i ; <%struct.CObject*> [#uses=0] + call void @llvm.dbg.stoppoint(i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) nounwind + call void @llvm.dbg.stoppoint(i32 27, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram28 to { }*)) + br label %bb + +bb: ; preds = %_Z13ReleaseObjectP7CObject.exit + call void @llvm.dbg.stoppoint(i32 27, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + br label %return + +return: ; preds = %bb + call void @llvm.dbg.stoppoint(i32 27, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit4 to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram54 to { }*)) + ret void +} + +define i32 @main() ssp { +entry: + %retval = alloca i32 ; <i32*> [#uses=2] + %C = alloca %struct.AAAAAImageParser* ; <%struct.AAAAAImageParser**> [#uses=3] + %0 = alloca i32 ; <i32*> [#uses=2] + %C.1 = alloca %struct.AAAAAImageParser* ; <%struct.AAAAAImageParser**> [#uses=4] + %1 = alloca %struct.AAAAAImageParser* ; <%struct.AAAAAImageParser**> [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram59 to { }*)) + %2 = bitcast %struct.AAAAAImageParser** %C to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %2, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable61 to { }*)) + call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %3 = call i8* @_Znwm(i32 4) ; <i8*> [#uses=1] + %4 = bitcast i8* %3 to %struct.AAAAAImageParser* ; <%struct.AAAAAImageParser*> [#uses=1] + store %struct.AAAAAImageParser* %4, %struct.AAAAAImageParser** %1, align 4 + %5 = load %struct.AAAAAImageParser** %1, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + %6 = getelementptr %struct.AAAAAImageParser* %5, i32 0, i32 0 ; <%struct.CObject**> [#uses=1] + %7 = load %struct.CObject** getelementptr (%struct.AAAAAImageParser* @_ZZ4mainE3C.0, i32 0, i32 0), align 4 ; <%struct.CObject*> [#uses=1] + store %struct.CObject* %7, %struct.CObject** %6, align 4 + %8 = load %struct.AAAAAImageParser** %1, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + store %struct.AAAAAImageParser* %8, %struct.AAAAAImageParser** %C, align 4 + call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %9 = load %struct.AAAAAImageParser** %C, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + store %struct.AAAAAImageParser* %9, %struct.AAAAAImageParser** %C.1, align 4 + %10 = load %struct.AAAAAImageParser** %C.1, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + %11 = icmp ne %struct.AAAAAImageParser* %10, null ; <i1> [#uses=1] + br i1 %11, label %bb, label %bb1 + ; No predecessors! + call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + br label %bb + +bb: ; preds = %12, %entry + call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + %13 = load %struct.AAAAAImageParser** %C.1, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + call void @_ZN16AAAAAImageParserD1Ev(%struct.AAAAAImageParser* %13) nounwind + %14 = load %struct.AAAAAImageParser** %C.1, align 4 ; <%struct.AAAAAImageParser*> [#uses=1] + %15 = bitcast %struct.AAAAAImageParser* %14 to i8* ; <i8*> [#uses=1] + call void @_ZdlPv(i8* %15) nounwind + br label %bb1 + +bb1: ; preds = %bb, %entry + call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + store i32 0, i32* %0, align 4 + %16 = load i32* %0, align 4 ; <i32> [#uses=1] + store i32 %16, i32* %retval, align 4 + br label %return + +return: ; preds = %bb1 + %retval2 = load i32* %retval ; <i32> [#uses=1] + call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram59 to { }*)) + ret i32 %retval2 +} + +declare i8* @_Znwm(i32) + +declare void @_ZdlPv(i8*) nounwind diff --git a/test/Feature/vector-cast-constant-exprs.ll b/test/Feature/vector-cast-constant-exprs.ll new file mode 100644 index 0000000..ffdc0f0 --- /dev/null +++ b/test/Feature/vector-cast-constant-exprs.ll @@ -0,0 +1,37 @@ +; RUN: llvm-as < %s | llvm-dis | not grep {ret.*(} + +; All of these constant expressions should fold. + +define <2 x float> @ga() { + ret <2 x float> fptrunc (<2 x double><double 4.3, double 3.2> to <2 x float>) +} +define <2 x double> @gb() { + ret <2 x double> fpext (<2 x float><float 2.0, float 8.0> to <2 x double>) +} +define <2 x i64> @gd() { + ret <2 x i64> zext (<2 x i32><i32 3, i32 4> to <2 x i64>) +} +define <2 x i64> @ge() { + ret <2 x i64> sext (<2 x i32><i32 3, i32 4> to <2 x i64>) +} +define <2 x i32> @gf() { + ret <2 x i32> trunc (<2 x i64><i64 3, i64 4> to <2 x i32>) +} +define <2 x i32> @gh() { + ret <2 x i32> fptoui (<2 x float><float 8.0, float 7.0> to <2 x i32>) +} +define <2 x i32> @gi() { + ret <2 x i32> fptosi (<2 x float><float 8.0, float 7.0> to <2 x i32>) +} +define <2 x float> @gj() { + ret <2 x float> uitofp (<2 x i32><i32 8, i32 7> to <2 x float>) +} +define <2 x float> @gk() { + ret <2 x float> sitofp (<2 x i32><i32 8, i32 7> to <2 x float>) +} +define <2 x double> @gl() { + ret <2 x double> bitcast (<2 x double><double 4.0, double 3.0> to <2 x double>) +} +define <2 x double> @gm() { + ret <2 x double> bitcast (<2 x i64><i64 4, i64 3> to <2 x double>) +} diff --git a/test/FrontendC++/2009-06-16-DebugInfoCrash.cpp b/test/FrontendC++/2009-06-16-DebugInfoCrash.cpp new file mode 100644 index 0000000..b3758d2 --- /dev/null +++ b/test/FrontendC++/2009-06-16-DebugInfoCrash.cpp @@ -0,0 +1,10 @@ +// RUN: %llvmgxx -c -emit-llvm %s -o /dev/null -g +// This crashes if we try to emit debug info for TEMPLATE_DECL members. +template <class T> class K2PtrVectorBase {}; +template <class T> class K2Vector {}; +template <class U > class K2Vector<U*> : public K2PtrVectorBase<U*> {}; +class ScriptInfoManager { + void PostRegister() ; + template <class SI> short ReplaceExistingElement(K2Vector<SI*>& v); +}; +void ScriptInfoManager::PostRegister() {} diff --git a/test/FrontendC++/2009-06-20-DarwinPPCLayout.cpp b/test/FrontendC++/2009-06-20-DarwinPPCLayout.cpp new file mode 100644 index 0000000..eef0e86 --- /dev/null +++ b/test/FrontendC++/2009-06-20-DarwinPPCLayout.cpp @@ -0,0 +1,32 @@ +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep baz | grep global | grep {struct.bar} +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep ccc | grep global | grep {struct.CC} +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep quux | grep global | grep {struct.bar} +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep foo | grep global | grep {struct.SRCFilter::FilterEntry} +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep {struct.bar} | grep {1 x i32} +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep {struct.CC} | grep {struct.bar} +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep {struct.bar} | grep {1 x i32} +// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep {struct.SRCFilter::FilterEntry} | not grep {1 x i32} +// XFAIL: * +// XTARGET: powerpc-apple-darwin + +template<class _T1, class _T2> struct payre { + _T1 first; + _T2 second; + payre() : first(), second() { } +}; +struct KBFP { + double mCutoffFrequency; +}; +class SRCFilter { + struct FilterEntry: public payre<KBFP, float*>{}; + static FilterEntry foo; +}; +SRCFilter::FilterEntry SRCFilter::foo; // 12 bytes +payre<KBFP, float*> baz; // 16 bytes +class CC { // 16 bytes + public: payre<KBFP, float*> x; +}; +class CC ccc; + +struct bar { KBFP x; float* y;}; // 16 bytes +struct bar quux; diff --git a/test/FrontendC/2009-06-14-HighlyAligned.c b/test/FrontendC/2009-06-14-HighlyAligned.c new file mode 100644 index 0000000..4678b75 --- /dev/null +++ b/test/FrontendC/2009-06-14-HighlyAligned.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc %s -S +// PR4332 + +static int highly_aligned __attribute__((aligned(4096))); + +int f() { + return highly_aligned; +} diff --git a/test/FrontendC/2009-06-18-StaticInitTailPadPack.c b/test/FrontendC/2009-06-18-StaticInitTailPadPack.c new file mode 100644 index 0000000..17f35c0 --- /dev/null +++ b/test/FrontendC/2009-06-18-StaticInitTailPadPack.c @@ -0,0 +1,26 @@ +// RUN: %llvmgcc %s -S -o - +// rdar://6983634 + + typedef struct A *Foo; +#pragma pack(push, 2) + struct Bar { + Foo f1; + unsigned short f2; + float f3; + }; + struct Baz { + struct Bar f1; + struct Bar f2; + }; + struct Qux { + unsigned long f1; + struct Baz f2; + }; +extern const struct Qux Bork; +const struct Qux Bork = { + 0, + { + {0}, + {0} + } +}; diff --git a/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll b/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll new file mode 100644 index 0000000..3322605 --- /dev/null +++ b/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llvm-dis | not grep ptrtoint +; PR4424 +@G = external global i32 +@test1 = constant i32 sdiv (i32 0, i32 ptrtoint (i32* @G to i32)) +@test2 = constant i32 udiv (i32 0, i32 ptrtoint (i32* @G to i32)) +@test3 = constant i32 srem (i32 0, i32 ptrtoint (i32* @G to i32)) +@test4 = constant i32 urem (i32 0, i32 ptrtoint (i32* @G to i32)) +@test5 = constant i32 lshr (i32 0, i32 ptrtoint (i32* @G to i32)) +@test6 = constant i32 ashr (i32 0, i32 ptrtoint (i32* @G to i32)) +@test7 = constant i32 shl (i32 0, i32 ptrtoint (i32* @G to i32)) + diff --git a/test/Transforms/ConstProp/div-zero.ll b/test/Transforms/ConstProp/div-zero.ll new file mode 100644 index 0000000..166c643 --- /dev/null +++ b/test/Transforms/ConstProp/div-zero.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0} +; PR4424 +declare void @ext() + +define i32 @foo(i32 %ptr) { +entry: + %zero = sub i32 %ptr, %ptr ; <i32> [#uses=1] + %div_zero = sdiv i32 %zero, ptrtoint (i32* getelementptr (i32* null, +i32 1) to i32) ; <i32> [#uses=1] + ret i32 %div_zero +} + diff --git a/test/Transforms/GVN/2009-06-17-InvalidPRE.ll b/test/Transforms/GVN/2009-06-17-InvalidPRE.ll new file mode 100644 index 0000000..c8982c8 --- /dev/null +++ b/test/Transforms/GVN/2009-06-17-InvalidPRE.ll @@ -0,0 +1,72 @@ +; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis | not grep pre1 +; GVN load pre was hoisting the loads at %13 and %16 up to bb4.outer. +; This is invalid as it bypasses the check for %m.0.ph==null in bb4. +; ModuleID = 'mbuf.c' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9.6" + %struct.mbuf = type { %struct.mbuf*, %struct.mbuf*, i32, i8*, i16, i16, i32 } + +define void @m_adj(%struct.mbuf* %mp, i32 %req_len) nounwind optsize { +entry: + %0 = icmp eq %struct.mbuf* %mp, null ; <i1> [#uses=1] + %1 = icmp slt i32 %req_len, 0 ; <i1> [#uses=1] + %or.cond = or i1 %1, %0 ; <i1> [#uses=1] + br i1 %or.cond, label %return, label %bb4.preheader + +bb4.preheader: ; preds = %entry + br label %bb4.outer + +bb2: ; preds = %bb1 + %2 = sub i32 %len.0, %13 ; <i32> [#uses=1] + %3 = getelementptr %struct.mbuf* %m.0.ph, i32 0, i32 2 ; <i32*> [#uses=1] + store i32 0, i32* %3, align 4 + %4 = getelementptr %struct.mbuf* %m.0.ph, i32 0, i32 0 ; <%struct.mbuf**> [#uses=1] + %5 = load %struct.mbuf** %4, align 4 ; <%struct.mbuf*> [#uses=1] + br label %bb4.outer + +bb4.outer: ; preds = %bb4.preheader, %bb2 + %m.0.ph = phi %struct.mbuf* [ %5, %bb2 ], [ %mp, %bb4.preheader ] ; <%struct.mbuf*> [#uses=7] + %len.0.ph = phi i32 [ %2, %bb2 ], [ %req_len, %bb4.preheader ] ; <i32> [#uses=1] + %6 = icmp ne %struct.mbuf* %m.0.ph, null ; <i1> [#uses=1] + %7 = getelementptr %struct.mbuf* %m.0.ph, i32 0, i32 2 ; <i32*> [#uses=1] + %8 = getelementptr %struct.mbuf* %m.0.ph, i32 0, i32 2 ; <i32*> [#uses=1] + %9 = getelementptr %struct.mbuf* %m.0.ph, i32 0, i32 3 ; <i8**> [#uses=1] + %10 = getelementptr %struct.mbuf* %m.0.ph, i32 0, i32 3 ; <i8**> [#uses=1] + br label %bb4 + +bb4: ; preds = %bb4.outer, %bb3 + %len.0 = phi i32 [ 0, %bb3 ], [ %len.0.ph, %bb4.outer ] ; <i32> [#uses=6] + %11 = icmp sgt i32 %len.0, 0 ; <i1> [#uses=1] + %12 = and i1 %11, %6 ; <i1> [#uses=1] + br i1 %12, label %bb1, label %bb7 + +bb1: ; preds = %bb4 + %13 = load i32* %7, align 4 ; <i32> [#uses=3] + %14 = icmp sgt i32 %13, %len.0 ; <i1> [#uses=1] + br i1 %14, label %bb3, label %bb2 + +bb3: ; preds = %bb1 + %15 = sub i32 %13, %len.0 ; <i32> [#uses=1] + store i32 %15, i32* %8, align 4 + %16 = load i8** %9, align 4 ; <i8*> [#uses=1] + %17 = getelementptr i8* %16, i32 %len.0 ; <i8*> [#uses=1] + store i8* %17, i8** %10, align 4 + br label %bb4 + +bb7: ; preds = %bb4 + %18 = getelementptr %struct.mbuf* %mp, i32 0, i32 5 ; <i16*> [#uses=1] + %19 = load i16* %18, align 2 ; <i16> [#uses=1] + %20 = zext i16 %19 to i32 ; <i32> [#uses=1] + %21 = and i32 %20, 2 ; <i32> [#uses=1] + %22 = icmp eq i32 %21, 0 ; <i1> [#uses=1] + br i1 %22, label %return, label %bb8 + +bb8: ; preds = %bb7 + %23 = sub i32 %req_len, %len.0 ; <i32> [#uses=1] + %24 = getelementptr %struct.mbuf* %mp, i32 0, i32 6 ; <i32*> [#uses=1] + store i32 %23, i32* %24, align 4 + ret void + +return: ; preds = %bb7, %entry + ret void +} diff --git a/test/Transforms/GVN/pre-single-pred.ll b/test/Transforms/GVN/pre-single-pred.ll index b735ea9..cb71617 100644 --- a/test/Transforms/GVN/pre-single-pred.ll +++ b/test/Transforms/GVN/pre-single-pred.ll @@ -1,6 +1,7 @@ ; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis | not grep {tmp3 = load} -define i32 @f(i32* nocapture %p, i32 %n) nounwind { +@p = external global i32 +define i32 @f(i32 %n) nounwind { entry: br label %for.cond @@ -13,9 +14,9 @@ for.cond.for.end_crit_edge: ; preds = %for.cond br label %for.end for.body: ; preds = %for.cond - %tmp3 = load i32* %p ; <i32> [#uses=1] + %tmp3 = load i32* @p ; <i32> [#uses=1] %dec = add i32 %tmp3, -1 ; <i32> [#uses=2] - store i32 %dec, i32* %p + store i32 %dec, i32* @p %cmp6 = icmp slt i32 %dec, 0 ; <i1> [#uses=1] br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc @@ -27,6 +28,6 @@ for.inc: ; preds = %for.body br label %for.cond for.end: ; preds = %for.body.for.end_crit_edge, %for.cond.for.end_crit_edge - %tmp9 = load i32* %p ; <i32> [#uses=1] + %tmp9 = load i32* @p ; <i32> [#uses=1] ret i32 %tmp9 } diff --git a/test/Transforms/IndVarSimplify/ashr-tripcount.ll b/test/Transforms/IndVarSimplify/ashr-tripcount.ll new file mode 100644 index 0000000..7b2cad2 --- /dev/null +++ b/test/Transforms/IndVarSimplify/ashr-tripcount.ll @@ -0,0 +1,107 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t +; RUN: grep sext %t | count 1 + +; Indvars should be able to eliminate all of the sign extensions +; inside the loop. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +@pow_2_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1] +@pow_2_025_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1] +@i_pow_2_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1] +@i_pow_2_025_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1] + +define void @foo(i32 %gain, i32 %noOfLines, i32* %quaSpectrum, float* %iquaSpectrum, float* %pow4_3_tab_ptr) nounwind { +entry: + %t0 = icmp slt i32 %gain, 0 ; <i1> [#uses=1] + br i1 %t0, label %bb1, label %bb2 + +bb1: ; preds = %entry + %t1 = sub i32 0, %gain ; <i32> [#uses=1] + %t2 = sub i32 0, %gain ; <i32> [#uses=1] + br label %bb2 + +bb2: ; preds = %bb1, %entry + %pow_2_tab.pn = phi [0 x float]* [ @i_pow_2_tab, %bb1 ], [ @pow_2_tab, %entry ] ; <[0 x float]*> [#uses=1] + %.pn3.in.in = phi i32 [ %t1, %bb1 ], [ %gain, %entry ] ; <i32> [#uses=1] + %pow_2_025_tab.pn = phi [0 x float]* [ @i_pow_2_025_tab, %bb1 ], [ @pow_2_025_tab, %entry ] ; <[0 x float]*> [#uses=1] + %.pn2.in.in = phi i32 [ %t2, %bb1 ], [ %gain, %entry ] ; <i32> [#uses=1] + %.pn3.in = ashr i32 %.pn3.in.in, 2 ; <i32> [#uses=1] + %.pn2.in = and i32 %.pn2.in.in, 3 ; <i32> [#uses=1] + %.pn3 = sext i32 %.pn3.in to i64 ; <i64> [#uses=1] + %.pn2 = zext i32 %.pn2.in to i64 ; <i64> [#uses=1] + %.pn.in = getelementptr [0 x float]* %pow_2_tab.pn, i64 0, i64 %.pn3 ; <float*> [#uses=1] + %.pn1.in = getelementptr [0 x float]* %pow_2_025_tab.pn, i64 0, i64 %.pn2 ; <float*> [#uses=1] + %.pn = load float* %.pn.in ; <float> [#uses=1] + %.pn1 = load float* %.pn1.in ; <float> [#uses=1] + %invQuantizer.0 = fmul float %.pn, %.pn1 ; <float> [#uses=4] + %t3 = ashr i32 %noOfLines, 2 ; <i32> [#uses=1] + %t4 = icmp sgt i32 %t3, 0 ; <i1> [#uses=1] + br i1 %t4, label %bb.nph, label %return + +bb.nph: ; preds = %bb2 + %t5 = ashr i32 %noOfLines, 2 ; <i32> [#uses=1] + br label %bb3 + +bb3: ; preds = %bb4, %bb.nph + %i.05 = phi i32 [ %t49, %bb4 ], [ 0, %bb.nph ] ; <i32> [#uses=9] + %k.04 = phi i32 [ %t48, %bb4 ], [ 0, %bb.nph ] ; <i32> [#uses=1] + %t6 = sext i32 %i.05 to i64 ; <i64> [#uses=1] + %t7 = getelementptr i32* %quaSpectrum, i64 %t6 ; <i32*> [#uses=1] + %t8 = load i32* %t7, align 4 ; <i32> [#uses=1] + %t9 = zext i32 %t8 to i64 ; <i64> [#uses=1] + %t10 = getelementptr float* %pow4_3_tab_ptr, i64 %t9 ; <float*> [#uses=1] + %t11 = load float* %t10, align 4 ; <float> [#uses=1] + %t12 = or i32 %i.05, 1 ; <i32> [#uses=1] + %t13 = sext i32 %t12 to i64 ; <i64> [#uses=1] + %t14 = getelementptr i32* %quaSpectrum, i64 %t13 ; <i32*> [#uses=1] + %t15 = load i32* %t14, align 4 ; <i32> [#uses=1] + %t16 = zext i32 %t15 to i64 ; <i64> [#uses=1] + %t17 = getelementptr float* %pow4_3_tab_ptr, i64 %t16 ; <float*> [#uses=1] + %t18 = load float* %t17, align 4 ; <float> [#uses=1] + %t19 = or i32 %i.05, 2 ; <i32> [#uses=1] + %t20 = sext i32 %t19 to i64 ; <i64> [#uses=1] + %t21 = getelementptr i32* %quaSpectrum, i64 %t20 ; <i32*> [#uses=1] + %t22 = load i32* %t21, align 4 ; <i32> [#uses=1] + %t23 = zext i32 %t22 to i64 ; <i64> [#uses=1] + %t24 = getelementptr float* %pow4_3_tab_ptr, i64 %t23 ; <float*> [#uses=1] + %t25 = load float* %t24, align 4 ; <float> [#uses=1] + %t26 = or i32 %i.05, 3 ; <i32> [#uses=1] + %t27 = sext i32 %t26 to i64 ; <i64> [#uses=1] + %t28 = getelementptr i32* %quaSpectrum, i64 %t27 ; <i32*> [#uses=1] + %t29 = load i32* %t28, align 4 ; <i32> [#uses=1] + %t30 = zext i32 %t29 to i64 ; <i64> [#uses=1] + %t31 = getelementptr float* %pow4_3_tab_ptr, i64 %t30 ; <float*> [#uses=1] + %t32 = load float* %t31, align 4 ; <float> [#uses=1] + %t33 = fmul float %t11, %invQuantizer.0 ; <float> [#uses=1] + %t34 = sext i32 %i.05 to i64 ; <i64> [#uses=1] + %t35 = getelementptr float* %iquaSpectrum, i64 %t34 ; <float*> [#uses=1] + store float %t33, float* %t35, align 4 + %t36 = or i32 %i.05, 1 ; <i32> [#uses=1] + %t37 = fmul float %t18, %invQuantizer.0 ; <float> [#uses=1] + %t38 = sext i32 %t36 to i64 ; <i64> [#uses=1] + %t39 = getelementptr float* %iquaSpectrum, i64 %t38 ; <float*> [#uses=1] + store float %t37, float* %t39, align 4 + %t40 = or i32 %i.05, 2 ; <i32> [#uses=1] + %t41 = fmul float %t25, %invQuantizer.0 ; <float> [#uses=1] + %t42 = sext i32 %t40 to i64 ; <i64> [#uses=1] + %t43 = getelementptr float* %iquaSpectrum, i64 %t42 ; <float*> [#uses=1] + store float %t41, float* %t43, align 4 + %t44 = or i32 %i.05, 3 ; <i32> [#uses=1] + %t45 = fmul float %t32, %invQuantizer.0 ; <float> [#uses=1] + %t46 = sext i32 %t44 to i64 ; <i64> [#uses=1] + %t47 = getelementptr float* %iquaSpectrum, i64 %t46 ; <float*> [#uses=1] + store float %t45, float* %t47, align 4 + %t48 = add i32 %k.04, 1 ; <i32> [#uses=2] + %t49 = add i32 %i.05, 4 ; <i32> [#uses=1] + br label %bb4 + +bb4: ; preds = %bb3 + %t50 = icmp sgt i32 %t5, %t48 ; <i1> [#uses=1] + br i1 %t50, label %bb3, label %bb4.return_crit_edge + +bb4.return_crit_edge: ; preds = %bb4 + br label %return + +return: ; preds = %bb4.return_crit_edge, %bb2 + ret void +} diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_6.ll b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll index 35fbf52..0d17a80 100644 --- a/test/Transforms/IndVarSimplify/loop_evaluate_6.ll +++ b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll @@ -1,7 +1,9 @@ ; RUN: llvm-as < %s | opt -indvars -loop-deletion | llvm-dis | grep phi | count 1 +; XFAIL: * -; Indvars should be able to evaluate this loop, allowing loop deletion -; to delete it. +; Indvars can't evaluate this loop, because ScalarEvolution can't compute +; an exact trip count, because it doesn't know if dividing by the stride will +; have a remainder. It could be done with more aggressive VRP though. define i32 @test(i32 %x_offs) nounwind readnone { entry: diff --git a/test/Transforms/IndVarSimplify/masked-iv.ll b/test/Transforms/IndVarSimplify/masked-iv.ll index c7583c9..f77b935 100644 --- a/test/Transforms/IndVarSimplify/masked-iv.ll +++ b/test/Transforms/IndVarSimplify/masked-iv.ll @@ -1,4 +1,6 @@ -; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep trunc | count 1 +; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t +; RUN: not grep trunc %t +; RUN: grep and %t | count 1 ; Indvars should do the IV arithmetic in the canonical IV type (i64), ; and only use one truncation. diff --git a/test/Transforms/IndVarSimplify/pointer.ll b/test/Transforms/IndVarSimplify/pointer.ll new file mode 100644 index 0000000..7ad1161 --- /dev/null +++ b/test/Transforms/IndVarSimplify/pointer.ll @@ -0,0 +1,38 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t +; RUN: grep {%exitcond = icmp eq i64 %indvar.next, %n} %t +; RUN: grep {getelementptr i8\\* %A, i64 %indvar} %t +; RUN: grep getelementptr %t | count 1 +; RUN: grep add %t | count 1 +; RUN: not grep scevgep %t +; RUN: not grep ptrtoint %t + +; Indvars should be able to expand the pointer-arithmetic +; IV into an integer IV indexing into a simple getelementptr. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + +define void @foo(i8* %A, i64 %n) nounwind { +entry: + %0 = icmp eq i64 %n, 0 ; <i1> [#uses=1] + br i1 %0, label %return, label %bb.nph + +bb.nph: ; preds = %entry + %1 = getelementptr i8* %A, i64 %n ; <i8*> [#uses=1] + br label %bb + +bb: ; preds = %bb1, %bb.nph + %q.01 = phi i8* [ %2, %bb1 ], [ %A, %bb.nph ] ; <i8*> [#uses=2] + store i8 0, i8* %q.01, align 1 + %2 = getelementptr i8* %q.01, i64 1 ; <i8*> [#uses=2] + br label %bb1 + +bb1: ; preds = %bb + %3 = icmp eq i8* %1, %2 ; <i1> [#uses=1] + br i1 %3, label %bb1.return_crit_edge, label %bb + +bb1.return_crit_edge: ; preds = %bb1 + br label %return + +return: ; preds = %bb1.return_crit_edge, %entry + ret void +} diff --git a/test/Transforms/IndVarSimplify/shrunk-constant.ll b/test/Transforms/IndVarSimplify/shrunk-constant.ll new file mode 100644 index 0000000..0b2ecaf --- /dev/null +++ b/test/Transforms/IndVarSimplify/shrunk-constant.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output \ +; RUN: | grep {\\--> (zext i4 {-7,+,-8}<loop> to i32)} + +define fastcc void @foo() nounwind { +entry: + br label %loop + +loop: + %i = phi i32 [ 0, %entry ], [ %t2, %loop ] + %t0 = add i32 %i, 9 + %t1 = and i32 %t0, 9 + store i32 %t1, i32* null + %t2 = add i32 %i, 8 + br label %loop +} diff --git a/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll b/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll index e86fed3..ffb55a7 100644 --- a/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll +++ b/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep store +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i32 0,} ; PR4366 define void @a() { diff --git a/test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll b/test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll new file mode 100644 index 0000000..82b223a --- /dev/null +++ b/test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem +; PR3439 + +define i32 @a(i32 %x) nounwind { +entry: + %rem = srem i32 %x, 2 + %and = and i32 %rem, 2 + ret i32 %and +} diff --git a/test/Transforms/InstCombine/select-load-call.ll b/test/Transforms/InstCombine/select-load-call.ll new file mode 100644 index 0000000..367356e --- /dev/null +++ b/test/Transforms/InstCombine/select-load-call.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 1} + +declare void @test2() + +define i32 @test(i1 %cond, i32 *%P) { + %A = alloca i32 + store i32 1, i32* %P + store i32 1, i32* %A + + call void @test2() readonly + + %P2 = select i1 %cond, i32 *%P, i32* %A + %V = load i32* %P2 + ret i32 %V +} diff --git a/test/Transforms/InstCombine/trunc-mask-ext.ll b/test/Transforms/InstCombine/trunc-mask-ext.ll new file mode 100644 index 0000000..7e3d844 --- /dev/null +++ b/test/Transforms/InstCombine/trunc-mask-ext.ll @@ -0,0 +1,38 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: not grep zext %t +; RUN: not grep sext %t + +; Instcombine should be able to eliminate all of these ext casts. + +declare void @use(i32) + +define i64 @foo(i64 %a) { + %b = trunc i64 %a to i32 + %c = and i32 %b, 15 + %d = zext i32 %c to i64 + call void @use(i32 %b) + ret i64 %d +} +define i64 @bar(i64 %a) { + %b = trunc i64 %a to i32 + %c = shl i32 %b, 4 + %q = ashr i32 %c, 4 + %d = sext i32 %q to i64 + call void @use(i32 %b) + ret i64 %d +} +define i64 @goo(i64 %a) { + %b = trunc i64 %a to i32 + %c = and i32 %b, 8 + %d = zext i32 %c to i64 + call void @use(i32 %b) + ret i64 %d +} +define i64 @hoo(i64 %a) { + %b = trunc i64 %a to i32 + %c = and i32 %b, 8 + %x = xor i32 %c, 8 + %d = zext i32 %x to i64 + call void @use(i32 %b) + ret i64 %d +} diff --git a/test/Transforms/InstCombine/vector-casts-0.ll b/test/Transforms/InstCombine/vector-casts-0.ll new file mode 100644 index 0000000..ae5b8a9 --- /dev/null +++ b/test/Transforms/InstCombine/vector-casts-0.ll @@ -0,0 +1,55 @@ +; RUN: llvm-as < %s | opt -instcombine + +define void @convert(<2 x i32>* %dst.addr, <2 x i64> %src) nounwind { +entry: + %val = trunc <2 x i64> %src to <2 x i32> ; <<2 x i32>> [#uses=1] + %add = add <2 x i32> %val, <i32 1, i32 1> ; <<2 x i32>> [#uses=1] + store <2 x i32> %add, <2 x i32>* %dst.addr + ret void +} + +define <2 x i65> @foo(<2 x i64> %t) { + %a = trunc <2 x i64> %t to <2 x i32> + %b = zext <2 x i32> %a to <2 x i65> + ret <2 x i65> %b +} +define <2 x i64> @bar(<2 x i65> %t) { + %a = trunc <2 x i65> %t to <2 x i32> + %b = zext <2 x i32> %a to <2 x i64> + ret <2 x i64> %b +} +define <2 x i65> @foos(<2 x i64> %t) { + %a = trunc <2 x i64> %t to <2 x i32> + %b = sext <2 x i32> %a to <2 x i65> + ret <2 x i65> %b +} +define <2 x i64> @bars(<2 x i65> %t) { + %a = trunc <2 x i65> %t to <2 x i32> + %b = sext <2 x i32> %a to <2 x i64> + ret <2 x i64> %b +} +define <2 x i64> @quxs(<2 x i64> %t) { + %a = trunc <2 x i64> %t to <2 x i32> + %b = sext <2 x i32> %a to <2 x i64> + ret <2 x i64> %b +} +define <2 x i64> @quxt(<2 x i64> %t) { + %a = shl <2 x i64> %t, <i64 32, i64 32> + %b = ashr <2 x i64> %a, <i64 32, i64 32> + ret <2 x i64> %b +} +define <2 x double> @fa(<2 x double> %t) { + %a = fptrunc <2 x double> %t to <2 x float> + %b = fpext <2 x float> %a to <2 x double> + ret <2 x double> %b +} +define <2 x double> @fb(<2 x double> %t) { + %a = fptoui <2 x double> %t to <2 x i64> + %b = uitofp <2 x i64> %a to <2 x double> + ret <2 x double> %b +} +define <2 x double> @fc(<2 x double> %t) { + %a = fptosi <2 x double> %t to <2 x i64> + %b = sitofp <2 x i64> %a to <2 x double> + ret <2 x double> %b +} diff --git a/test/Transforms/InstCombine/vector-casts-1.ll b/test/Transforms/InstCombine/vector-casts-1.ll new file mode 100644 index 0000000..a73a84a --- /dev/null +++ b/test/Transforms/InstCombine/vector-casts-1.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -instcombine > %t +; RUN: not grep trunc %t +; RUN: not grep ashr %t + +; This turns into a&1 != 0 +define <2 x i1> @a(<2 x i64> %a) { + %t = trunc <2 x i64> %a to <2 x i1> + ret <2 x i1> %t +} +; The ashr turns into an lshr. +define <2 x i64> @b(<2 x i64> %a) { + %b = and <2 x i64> %a, <i64 65535, i64 65535> + %t = ashr <2 x i64> %b, <i64 1, i64 1> + ret <2 x i64> %t +} diff --git a/test/Transforms/JumpThreading/branch-no-const.ll b/test/Transforms/JumpThreading/branch-no-const.ll new file mode 100644 index 0000000..0ea2431 --- /dev/null +++ b/test/Transforms/JumpThreading/branch-no-const.ll @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | opt -jump-threading | llvm-dis | not grep phi + +declare i8 @mcguffin() + +define i32 @test(i1 %foo, i8 %b) { +entry: + %a = call i8 @mcguffin() + br i1 %foo, label %bb1, label %bb2 +bb1: + br label %jt +bb2: + br label %jt +jt: + %x = phi i8 [%a, %bb1], [%b, %bb2] + %A = icmp eq i8 %x, %a + br i1 %A, label %rt, label %rf +rt: + ret i32 7 +rf: + ret i32 8 +} diff --git a/test/Transforms/JumpThreading/dup-cond.ll b/test/Transforms/JumpThreading/dup-cond.ll new file mode 100644 index 0000000..e20d939 --- /dev/null +++ b/test/Transforms/JumpThreading/dup-cond.ll @@ -0,0 +1,30 @@ +; RUN: llvm-as < %s | opt -jump-threading -die | llvm-dis | grep icmp | count 1 + +declare void @f1() +declare void @f2() +declare void @f3() + +define i32 @test(i32 %A) { + %tmp455 = icmp eq i32 %A, 42 + br i1 %tmp455, label %BB1, label %BB2 + +BB2: + call void @f1() + br label %BB1 + + +BB1: + %tmp459 = icmp eq i32 %A, 42 + br i1 %tmp459, label %BB3, label %BB4 + +BB3: + call void @f2() + ret i32 3 + +BB4: + call void @f3() + ret i32 4 +} + + + diff --git a/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll b/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll new file mode 100644 index 0000000..be1372d --- /dev/null +++ b/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | opt -analyze -iv-users -disable-output | grep {Stride i64 {3,+,2}<loop>:} + +; The value of %r is dependent on a polynomial iteration expression. + +define i64 @foo(i64 %n) { +entry: + br label %loop + +loop: + %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ] + %indvar.next = add i64 %indvar, 1 + %c = icmp eq i64 %indvar.next, %n + br i1 %c, label %exit, label %loop + +exit: + %r = mul i64 %indvar.next, %indvar.next + ret i64 %r +} diff --git a/test/Transforms/SimplifyCFG/2009-06-15-InvokeCrash.ll b/test/Transforms/SimplifyCFG/2009-06-15-InvokeCrash.ll new file mode 100644 index 0000000..d0e7ed7 --- /dev/null +++ b/test/Transforms/SimplifyCFG/2009-06-15-InvokeCrash.ll @@ -0,0 +1,557 @@ +; RUN: llvm-as < %s | opt -simplifycfg -disable-output +; END. + %struct..4._102 = type { %struct.QVectorData* } + %struct..5._125 = type { %struct.QMapData* } + %struct.QAbstractTextDocumentLayout = type { %struct.QObject } + %struct.QBasicAtomic = type { i32 } + %struct.QFont = type { %struct.QFontPrivate*, i32 } + %struct.QFontMetrics = type { %struct.QFontPrivate* } + %struct.QFontPrivate = type opaque + %"struct.QFragmentMap<QTextBlockData>" = type { %struct.QFragmentMapData } + %struct.QFragmentMapData = type { %"struct.QFragmentMapData::._154", i32 } + %"struct.QFragmentMapData::._154" = type { %"struct.QFragmentMapData::Header"* } + %"struct.QFragmentMapData::Header" = type { i32, i32, i32, i32, i32, i32, i32, i32 } + %"struct.QHash<uint,QHashDummyValue>" = type { %"struct.QHash<uint,QHashDummyValue>::._152" } + %"struct.QHash<uint,QHashDummyValue>::._152" = type { %struct.QHashData* } + %struct.QHashData = type { %"struct.QHashData::Node"*, %"struct.QHashData::Node"**, %struct.QBasicAtomic, i32, i32, i16, i16, i32, i8 } + %"struct.QHashData::Node" = type { %"struct.QHashData::Node"*, i32 } + %"struct.QList<QObject*>::._92" = type { %struct.QListData } + %"struct.QList<QPointer<QObject> >" = type { %"struct.QList<QObject*>::._92" } + %struct.QListData = type { %"struct.QListData::Data"* } + %"struct.QListData::Data" = type { %struct.QBasicAtomic, i32, i32, i32, i8, [1 x i8*] } + %"struct.QMap<QUrl,QVariant>" = type { %struct..5._125 } + %struct.QMapData = type { %"struct.QMapData::Node"*, [12 x %"struct.QMapData::Node"*], %struct.QBasicAtomic, i32, i32, i32, i8 } + %"struct.QMapData::Node" = type { %"struct.QMapData::Node"*, [1 x %"struct.QMapData::Node"*] } + %struct.QObject = type { i32 (...)**, %struct.QObjectData* } + %struct.QObjectData = type { i32 (...)**, %struct.QObject*, %struct.QObject*, %"struct.QList<QPointer<QObject> >", i8, [3 x i8], i32, i32 } + %struct.QObjectPrivate = type { %struct.QObjectData, i32, %struct.QObject*, %"struct.QList<QPointer<QObject> >", %"struct.QVector<QAbstractTextDocumentLayout::Selection>", %struct.QString } + %struct.QPaintDevice = type { i32 (...)**, i16 } + %struct.QPainter = type { %struct.QPainterPrivate* } + %struct.QPainterPrivate = type opaque + %struct.QPointF = type { double, double } + %struct.QPrinter = type { %struct.QPaintDevice, %struct.QPrinterPrivate* } + %struct.QPrinterPrivate = type opaque + %struct.QRectF = type { double, double, double, double } + %"struct.QSet<uint>" = type { %"struct.QHash<uint,QHashDummyValue>" } + %"struct.QSharedDataPointer<QTextFormatPrivate>" = type { %struct.QTextFormatPrivate* } + %struct.QString = type { %"struct.QString::Data"* } + %"struct.QString::Data" = type { %struct.QBasicAtomic, i32, i32, i16*, i8, i8, [1 x i16] } + %struct.QTextBlockFormat = type { %struct.QTextFormat } + %struct.QTextBlockGroup = type { %struct.QAbstractTextDocumentLayout } + %struct.QTextDocumentConfig = type { %struct.QString } + %struct.QTextDocumentPrivate = type { %struct.QObjectPrivate, %struct.QString, %"struct.QVector<QAbstractTextDocumentLayout::Selection>", i1, i32, i32, i1, i32, i32, i32, i32, i1, %struct.QTextFormatCollection, %struct.QTextBlockGroup*, %struct.QAbstractTextDocumentLayout*, %"struct.QFragmentMap<QTextBlockData>", %"struct.QFragmentMap<QTextBlockData>", i32, %"struct.QList<QPointer<QObject> >", %"struct.QList<QPointer<QObject> >", %"struct.QMap<QUrl,QVariant>", %"struct.QMap<QUrl,QVariant>", %"struct.QMap<QUrl,QVariant>", %struct.QTextDocumentConfig, i1, i1, %struct.QPointF } + %struct.QTextFormat = type { %"struct.QSharedDataPointer<QTextFormatPrivate>", i32 } + %struct.QTextFormatCollection = type { %"struct.QVector<QAbstractTextDocumentLayout::Selection>", %"struct.QVector<QAbstractTextDocumentLayout::Selection>", %"struct.QSet<uint>", %struct.QFont } + %struct.QTextFormatPrivate = type opaque + %"struct.QVector<QAbstractTextDocumentLayout::Selection>" = type { %struct..4._102 } + %struct.QVectorData = type { %struct.QBasicAtomic, i32, i32, i8 } + +define void @_ZNK13QTextDocument5printEP8QPrinter(%struct.QAbstractTextDocumentLayout* %this, %struct.QPrinter* %printer) { +entry: + %tmp = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=2] + %tmp.upgrd.1 = alloca %struct.QRectF, align 16 ; <%struct.QRectF*> [#uses=5] + %tmp2 = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=3] + %tmp.upgrd.2 = alloca %struct.QFontMetrics, align 16 ; <%struct.QFontMetrics*> [#uses=4] + %tmp.upgrd.3 = alloca %struct.QFont, align 16 ; <%struct.QFont*> [#uses=4] + %tmp3 = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=2] + %p = alloca %struct.QPainter, align 16 ; <%struct.QPainter*> [#uses=14] + %body = alloca %struct.QRectF, align 16 ; <%struct.QRectF*> [#uses=9] + %foo = alloca double, align 8 + %bar = alloca double, align 8 + %pageNumberPos = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=4] + %scaledPageSize = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=6] + %printerPageSize = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=3] + %fmt = alloca %struct.QTextBlockFormat, align 16 ; <%struct.QTextBlockFormat*> [#uses=5] + %font = alloca %struct.QFont, align 16 ; <%struct.QFont*> [#uses=5] + %tmp.upgrd.4 = call %struct.QTextDocumentPrivate* @_ZNK13QTextDocument6d_funcEv( %struct.QAbstractTextDocumentLayout* %this ) ; <%struct.QTextDocumentPrivate*> [#uses=5] + %tmp.upgrd.5 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1] + call void @_ZN8QPainterC1EP12QPaintDevice( %struct.QPainter* %p, %struct.QPaintDevice* %tmp.upgrd.5 ) + %tmp.upgrd.6 = invoke i1 @_ZNK8QPainter8isActiveEv( %struct.QPainter* %p ) + to label %invcont unwind label %cleanup329 ; <i1> [#uses=1] +invcont: ; preds = %entry + br i1 %tmp.upgrd.6, label %cond_next, label %cleanup328 +cond_next: ; preds = %invcont + %tmp8 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %this ) + to label %invcont7 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=0] +invcont7: ; preds = %cond_next + %tmp10 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26 ; <%struct.QPointF*> [#uses=1] + call void @_ZN7QPointFC1Edd( %struct.QPointF* %tmp, double 0.000000e+00, double 0.000000e+00 ) + call void @_ZN6QRectFC1ERK7QPointFRK6QSizeF( %struct.QRectF* %body, %struct.QPointF* %tmp, %struct.QPointF* %tmp10 ) + call void @_ZN7QPointFC1Ev( %struct.QPointF* %pageNumberPos ) + %tmp12 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26 ; <%struct.QPointF*> [#uses=1] + %tmp13 = call i1 @_ZNK6QSizeF7isValidEv( %struct.QPointF* %tmp12 ) ; <i1> [#uses=1] + br i1 %tmp13, label %cond_next15, label %bb +cond_next15: ; preds = %invcont7 + %tmp17 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26 ; <%struct.QPointF*> [#uses=1] + %tmp.upgrd.7 = call double @_ZNK6QSizeF6heightEv( %struct.QPointF* %tmp17 ) ; <double> [#uses=1] + %tmp18 = fcmp oeq double %tmp.upgrd.7, 0x41DFFFFFFFC00000 ; <i1> [#uses=1] + br i1 %tmp18, label %bb, label %cond_next20 +cond_next20: ; preds = %cond_next15 + br label %bb21 +bb: ; preds = %cond_next15, %invcont7 + br label %bb21 +bb21: ; preds = %bb, %cond_next20 + %iftmp.406.0 = phi i1 [ false, %bb ], [ true, %cond_next20 ] ; <i1> [#uses=1] + br i1 %iftmp.406.0, label %cond_true24, label %cond_false +cond_true24: ; preds = %bb21 + %tmp.upgrd.8 = invoke i32 @_Z13qt_defaultDpiv( ) + to label %invcont25 unwind label %cleanup329 ; <i32> [#uses=1] +invcont25: ; preds = %cond_true24 + %tmp26 = sitofp i32 %tmp.upgrd.8 to double ; <double> [#uses=2] + %tmp30 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %this ) + to label %invcont29 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=1] +invcont29: ; preds = %invcont25 + %tmp32 = invoke %struct.QPaintDevice* @_ZNK27QAbstractTextDocumentLayout11paintDeviceEv( %struct.QAbstractTextDocumentLayout* %tmp30 ) + to label %invcont31 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=3] +invcont31: ; preds = %invcont29 + %tmp34 = icmp eq %struct.QPaintDevice* %tmp32, null ; <i1> [#uses=1] + br i1 %tmp34, label %cond_next42, label %cond_true35 +cond_true35: ; preds = %invcont31 + %tmp38 = invoke i32 @_ZNK12QPaintDevice11logicalDpiXEv( %struct.QPaintDevice* %tmp32 ) + to label %invcont37 unwind label %cleanup329 ; <i32> [#uses=1] +invcont37: ; preds = %cond_true35 + %tmp38.upgrd.9 = sitofp i32 %tmp38 to double ; <double> [#uses=1] + %tmp41 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp32 ) + to label %invcont40 unwind label %cleanup329 ; <i32> [#uses=1] +invcont40: ; preds = %invcont37 + %tmp41.upgrd.10 = sitofp i32 %tmp41 to double ; <double> [#uses=1] + br label %cond_next42 +cond_next42: ; preds = %invcont40, %invcont31 + %sourceDpiY.2 = phi double [ %tmp41.upgrd.10, %invcont40 ], [ %tmp26, %invcont31 ] ; <double> [#uses=1] + %sourceDpiX.2 = phi double [ %tmp38.upgrd.9, %invcont40 ], [ %tmp26, %invcont31 ] ; <double> [#uses=1] + %tmp44 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp46 = invoke i32 @_ZNK12QPaintDevice11logicalDpiXEv( %struct.QPaintDevice* %tmp44 ) + to label %invcont45 unwind label %cleanup329 ; <i32> [#uses=1] +invcont45: ; preds = %cond_next42 + %tmp46.upgrd.11 = sitofp i32 %tmp46 to double ; <double> [#uses=1] + %tmp48 = fdiv double %tmp46.upgrd.11, %sourceDpiX.2 ; <double> [#uses=2] + %tmp50 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp52 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp50 ) + to label %invcont51 unwind label %cleanup329 ; <i32> [#uses=1] +invcont51: ; preds = %invcont45 + %tmp52.upgrd.12 = sitofp i32 %tmp52 to double ; <double> [#uses=1] + %tmp54 = fdiv double %tmp52.upgrd.12, %sourceDpiY.2 ; <double> [#uses=2] + invoke void @_ZN8QPainter5scaleEdd( %struct.QPainter* %p, double %tmp48, double %tmp54 ) + to label %invcont57 unwind label %cleanup329 +invcont57: ; preds = %invcont51 + %tmp.upgrd.13 = getelementptr %struct.QPointF* %scaledPageSize, i32 0, i32 0 ; <double*> [#uses=1] + %tmp60 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26, i32 0 ; <double*> [#uses=1] + %tmp61 = load double* %tmp60 ; <double> [#uses=1] + store double %tmp61, double* %tmp.upgrd.13 + %tmp62 = getelementptr %struct.QPointF* %scaledPageSize, i32 0, i32 1 ; <double*> [#uses=1] + %tmp63 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26, i32 1 ; <double*> [#uses=1] + %tmp64 = load double* %tmp63 ; <double> [#uses=1] + store double %tmp64, double* %tmp62 + %tmp65 = call double* @_ZN6QSizeF6rwidthEv( %struct.QPointF* %scaledPageSize ) ; <double*> [#uses=2] + %tmp67 = load double* %tmp65 ; <double> [#uses=1] + %tmp69 = mul double %tmp67, %tmp48 ; <double> [#uses=1] + store double %tmp69, double* %tmp65 + %tmp71 = call double* @_ZN6QSizeF7rheightEv( %struct.QPointF* %scaledPageSize ) ; <double*> [#uses=2] + %tmp73 = load double* %tmp71 ; <double> [#uses=1] + %tmp75 = mul double %tmp73, %tmp54 ; <double> [#uses=1] + store double %tmp75, double* %tmp71 + %tmp78 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp80 = invoke i32 @_ZNK12QPaintDevice6heightEv( %struct.QPaintDevice* %tmp78 ) + to label %invcont79 unwind label %cleanup329 ; <i32> [#uses=1] +invcont79: ; preds = %invcont57 + %tmp82 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp84 = invoke i32 @_ZNK12QPaintDevice5widthEv( %struct.QPaintDevice* %tmp82 ) + to label %invcont83 unwind label %cleanup329 ; <i32> [#uses=1] +invcont83: ; preds = %invcont79 + %tmp80.upgrd.14 = sitofp i32 %tmp80 to double ; <double> [#uses=1] + %tmp84.upgrd.15 = sitofp i32 %tmp84 to double ; <double> [#uses=1] + call void @_ZN6QSizeFC1Edd( %struct.QPointF* %printerPageSize, double %tmp84.upgrd.15, double %tmp80.upgrd.14 ) + %tmp85 = call double @_ZNK6QSizeF6heightEv( %struct.QPointF* %printerPageSize ) ; <double> [#uses=1] + %tmp86 = call double @_ZNK6QSizeF6heightEv( %struct.QPointF* %scaledPageSize ) ; <double> [#uses=1] + %tmp87 = fdiv double %tmp85, %tmp86 ; <double> [#uses=1] + %tmp88 = call double @_ZNK6QSizeF5widthEv( %struct.QPointF* %printerPageSize ) ; <double> [#uses=1] + %tmp89 = call double @_ZNK6QSizeF5widthEv( %struct.QPointF* %scaledPageSize ) ; <double> [#uses=1] + %tmp90 = fdiv double %tmp88, %tmp89 ; <double> [#uses=1] + invoke void @_ZN8QPainter5scaleEdd( %struct.QPainter* %p, double %tmp90, double %tmp87 ) + to label %cond_next194 unwind label %cleanup329 +cond_false: ; preds = %bb21 + %tmp.upgrd.16 = getelementptr %struct.QAbstractTextDocumentLayout* %this, i32 0, i32 0 ; <%struct.QObject*> [#uses=1] + %tmp95 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument5cloneEP7QObject( %struct.QAbstractTextDocumentLayout* %this, %struct.QObject* %tmp.upgrd.16 ) + to label %invcont94 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=9] +invcont94: ; preds = %cond_false + %tmp99 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) + to label %invcont98 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=1] +invcont98: ; preds = %invcont94 + %tmp101 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont100 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=1] +invcont100: ; preds = %invcont98 + invoke void @_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice( %struct.QAbstractTextDocumentLayout* %tmp99, %struct.QPaintDevice* %tmp101 ) + to label %invcont103 unwind label %cleanup329 +invcont103: ; preds = %invcont100 + %tmp105 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont104 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=1] +invcont104: ; preds = %invcont103 + %tmp107 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp105 ) + to label %invcont106 unwind label %cleanup329 ; <i32> [#uses=1] +invcont106: ; preds = %invcont104 + %tmp108 = sitofp i32 %tmp107 to double ; <double> [#uses=1] + %tmp109 = mul double %tmp108, 0x3FE93264C993264C ; <double> [#uses=1] + %tmp109.upgrd.17 = fptosi double %tmp109 to i32 ; <i32> [#uses=3] + %tmp.upgrd.18 = call %struct.QTextBlockGroup* @_ZNK13QTextDocument9rootFrameEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) ; <%struct.QTextBlockGroup*> [#uses=1] + invoke void @_ZNK10QTextFrame11frameFormatEv( %struct.QTextBlockFormat* sret %fmt, %struct.QTextBlockGroup* %tmp.upgrd.18 ) + to label %invcont111 unwind label %cleanup329 +invcont111: ; preds = %invcont106 + %tmp112 = sitofp i32 %tmp109.upgrd.17 to double ; <double> [#uses=1] + invoke void @_ZN16QTextFrameFormat9setMarginEd( %struct.QTextBlockFormat* %fmt, double %tmp112 ) + to label %invcont114 unwind label %cleanup192 +invcont114: ; preds = %invcont111 + %tmp116 = call %struct.QTextBlockGroup* @_ZNK13QTextDocument9rootFrameEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) ; <%struct.QTextBlockGroup*> [#uses=1] + invoke void @_ZN10QTextFrame14setFrameFormatERK16QTextFrameFormat( %struct.QTextBlockGroup* %tmp116, %struct.QTextBlockFormat* %fmt ) + to label %invcont117 unwind label %cleanup192 +invcont117: ; preds = %invcont114 + %tmp119 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont118 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1] +invcont118: ; preds = %invcont117 + %tmp121 = invoke i32 @_ZNK12QPaintDevice6heightEv( %struct.QPaintDevice* %tmp119 ) + to label %invcont120 unwind label %cleanup192 ; <i32> [#uses=1] +invcont120: ; preds = %invcont118 + %tmp121.upgrd.19 = sitofp i32 %tmp121 to double ; <double> [#uses=1] + %tmp123 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont122 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1] +invcont122: ; preds = %invcont120 + %tmp125 = invoke i32 @_ZNK12QPaintDevice5widthEv( %struct.QPaintDevice* %tmp123 ) + to label %invcont124 unwind label %cleanup192 ; <i32> [#uses=1] +invcont124: ; preds = %invcont122 + %tmp125.upgrd.20 = sitofp i32 %tmp125 to double ; <double> [#uses=1] + call void @_ZN6QRectFC1Edddd( %struct.QRectF* %tmp.upgrd.1, double 0.000000e+00, double 0.000000e+00, double %tmp125.upgrd.20, double %tmp121.upgrd.19 ) + %tmp126 = getelementptr %struct.QRectF* %body, i32 0, i32 0 ; <double*> [#uses=1] + %tmp127 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 0 ; <double*> [#uses=1] + %tmp128 = load double* %tmp127 ; <double> [#uses=1] + store double %tmp128, double* %tmp126 + %tmp129 = getelementptr %struct.QRectF* %body, i32 0, i32 1 ; <double*> [#uses=1] + %tmp130 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 1 ; <double*> [#uses=1] + %tmp131 = load double* %tmp130 ; <double> [#uses=1] + store double %tmp131, double* %tmp129 + %tmp132 = getelementptr %struct.QRectF* %body, i32 0, i32 2 ; <double*> [#uses=1] + %tmp133 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 2 ; <double*> [#uses=1] + %tmp134 = load double* %tmp133 ; <double> [#uses=1] + store double %tmp134, double* %tmp132 + %tmp135 = getelementptr %struct.QRectF* %body, i32 0, i32 3 ; <double*> [#uses=1] + %tmp136 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 3 ; <double*> [#uses=1] + %tmp137 = load double* %tmp136 ; <double> [#uses=1] + store double %tmp137, double* %tmp135 + %tmp138 = call double @_ZNK6QRectF6heightEv( %struct.QRectF* %body ) ; <double> [#uses=1] + %tmp139 = sitofp i32 %tmp109.upgrd.17 to double ; <double> [#uses=1] + %tmp140 = sub double %tmp138, %tmp139 ; <double> [#uses=1] + %tmp142 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont141 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1] +invcont141: ; preds = %invcont124 + invoke void @_ZNK13QTextDocument11defaultFontEv( %struct.QFont* sret %tmp.upgrd.3, %struct.QAbstractTextDocumentLayout* %tmp95 ) + to label %invcont144 unwind label %cleanup192 +invcont144: ; preds = %invcont141 + invoke void @_ZN12QFontMetricsC1ERK5QFontP12QPaintDevice( %struct.QFontMetrics* %tmp.upgrd.2, %struct.QFont* %tmp.upgrd.3, %struct.QPaintDevice* %tmp142 ) + to label %invcont146 unwind label %cleanup173 +invcont146: ; preds = %invcont144 + %tmp149 = invoke i32 @_ZNK12QFontMetrics6ascentEv( %struct.QFontMetrics* %tmp.upgrd.2 ) + to label %invcont148 unwind label %cleanup168 ; <i32> [#uses=1] +invcont148: ; preds = %invcont146 + %tmp149.upgrd.21 = sitofp i32 %tmp149 to double ; <double> [#uses=1] + %tmp150 = add double %tmp140, %tmp149.upgrd.21 ; <double> [#uses=1] + %tmp152 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont151 unwind label %cleanup168 ; <%struct.QPaintDevice*> [#uses=1] +invcont151: ; preds = %invcont148 + %tmp154 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp152 ) + to label %invcont153 unwind label %cleanup168 ; <i32> [#uses=1] +invcont153: ; preds = %invcont151 + %tmp155 = mul i32 %tmp154, 5 ; <i32> [#uses=1] + %tmp156 = sdiv i32 %tmp155, 72 ; <i32> [#uses=1] + %tmp156.upgrd.22 = sitofp i32 %tmp156 to double ; <double> [#uses=1] + %tmp157 = add double %tmp150, %tmp156.upgrd.22 ; <double> [#uses=1] + %tmp158 = call double @_ZNK6QRectF5widthEv( %struct.QRectF* %body ) ; <double> [#uses=1] + %tmp159 = sitofp i32 %tmp109.upgrd.17 to double ; <double> [#uses=1] + %tmp160 = sub double %tmp158, %tmp159 ; <double> [#uses=1] + call void @_ZN7QPointFC1Edd( %struct.QPointF* %tmp2, double %tmp160, double %tmp157 ) + %tmp161 = getelementptr %struct.QPointF* %pageNumberPos, i32 0, i32 0 ; <double*> [#uses=1] + %tmp162 = getelementptr %struct.QPointF* %tmp2, i32 0, i32 0 ; <double*> [#uses=1] + %tmp163 = load double* %tmp162 ; <double> [#uses=1] + store double %tmp163, double* %tmp161 + %tmp164 = getelementptr %struct.QPointF* %pageNumberPos, i32 0, i32 1 ; <double*> [#uses=1] + %tmp165 = getelementptr %struct.QPointF* %tmp2, i32 0, i32 1 ; <double*> [#uses=1] + %tmp166 = load double* %tmp165 ; <double> [#uses=1] + store double %tmp166, double* %tmp164 + invoke void @_ZN12QFontMetricsD1Ev( %struct.QFontMetrics* %tmp.upgrd.2 ) + to label %cleanup171 unwind label %cleanup173 +cleanup168: ; preds = %invcont151, %invcont148, %invcont146 + invoke void @_ZN12QFontMetricsD1Ev( %struct.QFontMetrics* %tmp.upgrd.2 ) + to label %cleanup173 unwind label %cleanup173 +cleanup171: ; preds = %invcont153 + invoke void @_ZN5QFontD1Ev( %struct.QFont* %tmp.upgrd.3 ) + to label %finally170 unwind label %cleanup192 +cleanup173: ; preds = %cleanup168, %cleanup168, %invcont153, %invcont144 + invoke void @_ZN5QFontD1Ev( %struct.QFont* %tmp.upgrd.3 ) + to label %cleanup192 unwind label %cleanup192 +finally170: ; preds = %cleanup171 + invoke void @_ZNK13QTextDocument11defaultFontEv( %struct.QFont* sret %font, %struct.QAbstractTextDocumentLayout* %tmp95 ) + to label %invcont177 unwind label %cleanup192 +invcont177: ; preds = %finally170 + invoke void @_ZN5QFont12setPointSizeEi( %struct.QFont* %font, i32 10 ) + to label %invcont179 unwind label %cleanup187 +invcont179: ; preds = %invcont177 + invoke void @_ZN13QTextDocument14setDefaultFontERK5QFont( %struct.QAbstractTextDocumentLayout* %tmp95, %struct.QFont* %font ) + to label %invcont181 unwind label %cleanup187 +invcont181: ; preds = %invcont179 + call void @_ZNK6QRectF4sizeEv( %struct.QPointF* sret %tmp3, %struct.QRectF* %body ) + invoke void @_ZN13QTextDocument11setPageSizeERK6QSizeF( %struct.QAbstractTextDocumentLayout* %tmp95, %struct.QPointF* %tmp3 ) + to label %cleanup185 unwind label %cleanup187 +cleanup185: ; preds = %invcont181 + invoke void @_ZN5QFontD1Ev( %struct.QFont* %font ) + to label %cleanup190 unwind label %cleanup192 +cleanup187: ; preds = %invcont181, %invcont179, %invcont177 + invoke void @_ZN5QFontD1Ev( %struct.QFont* %font ) + to label %cleanup192 unwind label %cleanup192 +cleanup190: ; preds = %cleanup185 + invoke void @_ZN16QTextFrameFormatD1Ev( %struct.QTextBlockFormat* %fmt ) + to label %cond_next194 unwind label %cleanup329 +cleanup192: ; preds = %cleanup187, %cleanup187, %cleanup185, %finally170, %cleanup173, %cleanup173, %cleanup171, %invcont141, %invcont124, %invcont122, %invcont120, %invcont118, %invcont117, %invcont114, %invcont111 + invoke void @_ZN16QTextFrameFormatD1Ev( %struct.QTextBlockFormat* %fmt ) + to label %cleanup329 unwind label %cleanup329 +cond_next194: ; preds = %cleanup190, %invcont83 + %clonedDoc.1 = phi %struct.QAbstractTextDocumentLayout* [ null, %invcont83 ], [ %tmp95, %cleanup190 ] ; <%struct.QAbstractTextDocumentLayout*> [#uses=3] + %doc.1 = phi %struct.QAbstractTextDocumentLayout* [ %this, %invcont83 ], [ %tmp95, %cleanup190 ] ; <%struct.QAbstractTextDocumentLayout*> [#uses=2] + %tmp197 = invoke i1 @_ZNK8QPrinter13collateCopiesEv( %struct.QPrinter* %printer ) + to label %invcont196 unwind label %cleanup329 ; <i1> [#uses=1] +invcont196: ; preds = %cond_next194 + br i1 %tmp197, label %cond_true200, label %cond_false204 +cond_true200: ; preds = %invcont196 + %tmp2000 = load double* %foo + store double %tmp2000, double* %bar + %tmp203 = invoke i32 @_ZNK8QPrinter9numCopiesEv( %struct.QPrinter* %printer ) + to label %cond_next208 unwind label %cleanup329 ; <i32> [#uses=1] +cond_false204: ; preds = %invcont196 + %tmp2001 = load double* %foo + store double %tmp2001, double* %bar + %tmp207 = invoke i32 @_ZNK8QPrinter9numCopiesEv( %struct.QPrinter* %printer ) + to label %cond_next208 unwind label %cleanup329 ; <i32> [#uses=1] +cond_next208: ; preds = %invcont206, %invcont202 + %pageCopies.0 = phi i32 [ %tmp203, %cond_true200 ], [ 1, %cond_false204 ] ; <i32> [#uses=2] + %docCopies.0 = phi i32 [ 1, %cond_true200 ], [ %tmp207, %cond_false204 ] ; <i32> [#uses=2] + %tmp211 = invoke i32 @_ZNK8QPrinter8fromPageEv( %struct.QPrinter* %printer ) + to label %invcont210 unwind label %cleanup329 ; <i32> [#uses=3] +invcont210: ; preds = %cond_next208 + %tmp214 = invoke i32 @_ZNK8QPrinter6toPageEv( %struct.QPrinter* %printer ) + to label %invcont213 unwind label %cleanup329 ; <i32> [#uses=3] +invcont213: ; preds = %invcont210 + %tmp216 = icmp eq i32 %tmp211, 0 ; <i1> [#uses=1] + br i1 %tmp216, label %cond_true217, label %cond_next225 +cond_true217: ; preds = %invcont213 + %tmp219 = icmp eq i32 %tmp214, 0 ; <i1> [#uses=1] + br i1 %tmp219, label %cond_true220, label %cond_next225 +cond_true220: ; preds = %cond_true217 + %tmp223 = invoke i32 @_ZNK13QTextDocument9pageCountEv( %struct.QAbstractTextDocumentLayout* %doc.1 ) + to label %invcont222 unwind label %cleanup329 ; <i32> [#uses=1] +invcont222: ; preds = %cond_true220 + br label %cond_next225 +cond_next225: ; preds = %invcont222, %cond_true217, %invcont213 + %toPage.1 = phi i32 [ %tmp223, %invcont222 ], [ %tmp214, %cond_true217 ], [ %tmp214, %invcont213 ] ; <i32> [#uses=2] + %fromPage.1 = phi i32 [ 1, %invcont222 ], [ %tmp211, %cond_true217 ], [ %tmp211, %invcont213 ] ; <i32> [#uses=2] + %tmp.page = invoke i32 @_ZNK8QPrinter9pageOrderEv( %struct.QPrinter* %printer ) + to label %invcont227 unwind label %cleanup329 ; <i32> [#uses=1] +invcont227: ; preds = %cond_next225 + %tmp228 = icmp eq i32 %tmp.page, 1 ; <i1> [#uses=1] + br i1 %tmp228, label %cond_true230, label %cond_next234 +cond_true230: ; preds = %invcont227 + br label %cond_next234 +cond_next234: ; preds = %cond_true230, %invcont227 + %ascending.1 = phi i1 [ false, %cond_true230 ], [ true, %invcont227 ] ; <i1> [#uses=1] + %toPage.2 = phi i32 [ %fromPage.1, %cond_true230 ], [ %toPage.1, %invcont227 ] ; <i32> [#uses=1] + %fromPage.2 = phi i32 [ %toPage.1, %cond_true230 ], [ %fromPage.1, %invcont227 ] ; <i32> [#uses=1] + br label %bb309 +bb237: ; preds = %cond_true313, %cond_next293 + %iftmp.410.4 = phi i1 [ %iftmp.410.5, %cond_true313 ], [ %iftmp.410.1, %cond_next293 ] ; <i1> [#uses=1] + %page.4 = phi i32 [ %fromPage.2, %cond_true313 ], [ %page.3, %cond_next293 ] ; <i32> [#uses=4] + br label %bb273 +invcont240: ; preds = %cond_true277 + %tmp242 = icmp eq i32 %tmp241, 2 ; <i1> [#uses=1] + br i1 %tmp242, label %bb252, label %cond_next244 +cond_next244: ; preds = %invcont240 + %tmp247 = invoke i32 @_ZNK8QPrinter12printerStateEv( %struct.QPrinter* %printer ) + to label %invcont246 unwind label %cleanup329 ; <i32> [#uses=1] +invcont246: ; preds = %cond_next244 + %tmp248 = icmp eq i32 %tmp247, 3 ; <i1> [#uses=1] + br i1 %tmp248, label %bb252, label %bb253 +bb252: ; preds = %invcont246, %invcont240 + br label %bb254 +bb253: ; preds = %invcont246 + br label %bb254 +bb254: ; preds = %bb253, %bb252 + %iftmp.410.0 = phi i1 [ true, %bb252 ], [ false, %bb253 ] ; <i1> [#uses=2] + br i1 %iftmp.410.0, label %UserCanceled, label %cond_next258 +cond_next258: ; preds = %bb254 + invoke fastcc void @_Z9printPageiP8QPainterPK13QTextDocumentRK6QRectFRK7QPointF( i32 %page.4, %struct.QPainter* %p, %struct.QAbstractTextDocumentLayout* %doc.1, %struct.QRectF* %body, %struct.QPointF* %pageNumberPos ) + to label %invcont261 unwind label %cleanup329 +invcont261: ; preds = %cond_next258 + %tmp263 = add i32 %pageCopies.0, -1 ; <i32> [#uses=1] + %tmp265 = icmp sgt i32 %tmp263, %j.4 ; <i1> [#uses=1] + br i1 %tmp265, label %cond_true266, label %cond_next270 +cond_true266: ; preds = %invcont261 + %tmp269 = invoke i1 @_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer ) + to label %cond_next270 unwind label %cleanup329 ; <i1> [#uses=0] +cond_next270: ; preds = %cond_true266, %invcont261 + %tmp272 = add i32 %j.4, 1 ; <i32> [#uses=1] + br label %bb273 +bb273: ; preds = %cond_next270, %bb237 + %iftmp.410.1 = phi i1 [ %iftmp.410.4, %bb237 ], [ %iftmp.410.0, %cond_next270 ] ; <i1> [#uses=2] + %j.4 = phi i32 [ 0, %bb237 ], [ %tmp272, %cond_next270 ] ; <i32> [#uses=3] + %tmp276 = icmp slt i32 %j.4, %pageCopies.0 ; <i1> [#uses=1] + br i1 %tmp276, label %cond_true277, label %bb280 +cond_true277: ; preds = %bb273 + %tmp241 = invoke i32 @_ZNK8QPrinter12printerStateEv( %struct.QPrinter* %printer ) + to label %invcont240 unwind label %cleanup329 ; <i32> [#uses=1] +bb280: ; preds = %bb273 + %tmp283 = icmp eq i32 %page.4, %toPage.2 ; <i1> [#uses=1] + br i1 %tmp283, label %bb297, label %cond_next285 +cond_next285: ; preds = %bb280 + br i1 %ascending.1, label %cond_true287, label %cond_false290 +cond_true287: ; preds = %cond_next285 + %tmp289 = add i32 %page.4, 1 ; <i32> [#uses=1] + br label %cond_next293 +cond_false290: ; preds = %cond_next285 + %tmp292 = add i32 %page.4, -1 ; <i32> [#uses=1] + br label %cond_next293 +cond_next293: ; preds = %cond_false290, %cond_true287 + %page.3 = phi i32 [ %tmp289, %cond_true287 ], [ %tmp292, %cond_false290 ] ; <i32> [#uses=1] + %tmp296 = invoke i1 @_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer ) + to label %bb237 unwind label %cleanup329 ; <i1> [#uses=0] +bb297: ; preds = %bb280 + %tmp299 = add i32 %docCopies.0, -1 ; <i32> [#uses=1] + %tmp301 = icmp sgt i32 %tmp299, %i.1 ; <i1> [#uses=1] + br i1 %tmp301, label %cond_true302, label %cond_next306 +cond_true302: ; preds = %bb297 + %tmp305 = invoke i1 @_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer ) + to label %cond_next306 unwind label %cleanup329 ; <i1> [#uses=0] +cond_next306: ; preds = %cond_true302, %bb297 + %tmp308 = add i32 %i.1, 1 ; <i32> [#uses=1] + br label %bb309 +bb309: ; preds = %cond_next306, %cond_next234 + %iftmp.410.5 = phi i1 [ undef, %cond_next234 ], [ %iftmp.410.1, %cond_next306 ] ; <i1> [#uses=1] + %i.1 = phi i32 [ 0, %cond_next234 ], [ %tmp308, %cond_next306 ] ; <i32> [#uses=3] + %tmp312 = icmp slt i32 %i.1, %docCopies.0 ; <i1> [#uses=1] + br i1 %tmp312, label %cond_true313, label %UserCanceled +cond_true313: ; preds = %bb309 + br label %bb237 +UserCanceled: ; preds = %bb309, %bb254 + %tmp318 = icmp eq %struct.QAbstractTextDocumentLayout* %clonedDoc.1, null ; <i1> [#uses=1] + br i1 %tmp318, label %cleanup327, label %cond_true319 +cond_true319: ; preds = %UserCanceled + %tmp.upgrd.23 = getelementptr %struct.QAbstractTextDocumentLayout* %clonedDoc.1, i32 0, i32 0, i32 0 ; <i32 (...)***> [#uses=1] + %tmp.upgrd.24 = load i32 (...)*** %tmp.upgrd.23 ; <i32 (...)**> [#uses=1] + %tmp322 = getelementptr i32 (...)** %tmp.upgrd.24, i32 4 ; <i32 (...)**> [#uses=1] + %tmp.upgrd.25 = load i32 (...)** %tmp322 ; <i32 (...)*> [#uses=1] + %tmp.upgrd.26 = bitcast i32 (...)* %tmp.upgrd.25 to void (%struct.QAbstractTextDocumentLayout*)* ; <void (%struct.QAbstractTextDocumentLayout*)*> [#uses=1] + invoke void %tmp.upgrd.26( %struct.QAbstractTextDocumentLayout* %clonedDoc.1 ) + to label %cleanup327 unwind label %cleanup329 +cleanup327: ; preds = %cond_true319, %UserCanceled + call void @_ZN8QPainterD1Ev( %struct.QPainter* %p ) + ret void +cleanup328: ; preds = %invcont + call void @_ZN8QPainterD1Ev( %struct.QPainter* %p ) + ret void +cleanup329: ; preds = %cond_true319, %cond_true302, %cond_next293, %cond_true277, %cond_true266, %cond_next258, %cond_next244, %cond_next225, %cond_true220, %invcont210, %cond_next208, %cond_false204, %cond_true200, %cond_next194, %cleanup192, %cleanup192, %cleanup190, %invcont106, %invcont104, %invcont103, %invcont100, %invcont98, %invcont94, %cond_false, %invcont83, %invcont79, %invcont57, %invcont51, %invcont45, %cond_next42, %invcont37, %cond_true35, %invcont29, %invcont25, %cond_true24, %cond_next, %entry + call void @_ZN8QPainterD1Ev( %struct.QPainter* %p ) + unwind +} + +declare void @_ZN6QSizeFC1Edd(%struct.QPointF*, double, double) + +declare i1 @_ZNK6QSizeF7isValidEv(%struct.QPointF*) + +declare double @_ZNK6QSizeF5widthEv(%struct.QPointF*) + +declare double @_ZNK6QSizeF6heightEv(%struct.QPointF*) + +declare double* @_ZN6QSizeF6rwidthEv(%struct.QPointF*) + +declare double* @_ZN6QSizeF7rheightEv(%struct.QPointF*) + +declare %struct.QTextDocumentPrivate* @_ZNK13QTextDocument6d_funcEv(%struct.QAbstractTextDocumentLayout*) + +declare void @_ZN7QPointFC1Ev(%struct.QPointF*) + +declare void @_ZN7QPointFC1Edd(%struct.QPointF*, double, double) + +declare void @_ZN16QTextFrameFormat9setMarginEd(%struct.QTextBlockFormat*, double) + +declare void @_ZN6QRectFC1Edddd(%struct.QRectF*, double, double, double, double) + +declare void @_ZN6QRectFC1ERK7QPointFRK6QSizeF(%struct.QRectF*, %struct.QPointF*, %struct.QPointF*) + +declare double @_ZNK6QRectF5widthEv(%struct.QRectF*) + +declare double @_ZNK6QRectF6heightEv(%struct.QRectF*) + +declare void @_ZNK6QRectF4sizeEv(%struct.QPointF*, %struct.QRectF*) + +declare void @_ZN16QTextFrameFormatD1Ev(%struct.QTextBlockFormat*) + +declare void @_ZNK10QTextFrame11frameFormatEv(%struct.QTextBlockFormat*, %struct.QTextBlockGroup*) + +declare void @_ZN10QTextFrame14setFrameFormatERK16QTextFrameFormat(%struct.QTextBlockGroup*, %struct.QTextBlockFormat*) + +declare i32 @_ZNK12QPaintDevice5widthEv(%struct.QPaintDevice*) + +declare i32 @_ZNK12QPaintDevice6heightEv(%struct.QPaintDevice*) + +declare i32 @_ZNK12QPaintDevice11logicalDpiXEv(%struct.QPaintDevice*) + +declare i32 @_ZNK12QPaintDevice11logicalDpiYEv(%struct.QPaintDevice*) + +declare %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument5cloneEP7QObject(%struct.QAbstractTextDocumentLayout*, %struct.QObject*) + +declare void @_ZN5QFontD1Ev(%struct.QFont*) + +declare %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv(%struct.QAbstractTextDocumentLayout*) + +declare %struct.QTextBlockGroup* @_ZNK13QTextDocument9rootFrameEv(%struct.QAbstractTextDocumentLayout*) + +declare i32 @_ZNK13QTextDocument9pageCountEv(%struct.QAbstractTextDocumentLayout*) + +declare void @_ZNK13QTextDocument11defaultFontEv(%struct.QFont*, %struct.QAbstractTextDocumentLayout*) + +declare void @_ZN13QTextDocument14setDefaultFontERK5QFont(%struct.QAbstractTextDocumentLayout*, %struct.QFont*) + +declare void @_ZN13QTextDocument11setPageSizeERK6QSizeF(%struct.QAbstractTextDocumentLayout*, %struct.QPointF*) + +declare void @_Z9printPageiP8QPainterPK13QTextDocumentRK6QRectFRK7QPointF(i32, %struct.QPainter*, %struct.QAbstractTextDocumentLayout*, %struct.QRectF*, %struct.QPointF*) + +declare void @_ZN12QFontMetricsD1Ev(%struct.QFontMetrics*) + +declare void @_ZN8QPainterC1EP12QPaintDevice(%struct.QPainter*, %struct.QPaintDevice*) + +declare i1 @_ZNK8QPainter8isActiveEv(%struct.QPainter*) + +declare i32 @_Z13qt_defaultDpiv() + +declare %struct.QPaintDevice* @_ZNK27QAbstractTextDocumentLayout11paintDeviceEv(%struct.QAbstractTextDocumentLayout*) + +declare void @_ZN8QPainter5scaleEdd(%struct.QPainter*, double, double) + +declare %struct.QPaintDevice* @_ZNK8QPainter6deviceEv(%struct.QPainter*) + +declare void @_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice(%struct.QAbstractTextDocumentLayout*, %struct.QPaintDevice*) + +declare void @_ZN12QFontMetricsC1ERK5QFontP12QPaintDevice(%struct.QFontMetrics*, %struct.QFont*, %struct.QPaintDevice*) + +declare i32 @_ZNK12QFontMetrics6ascentEv(%struct.QFontMetrics*) + +declare void @_ZN5QFont12setPointSizeEi(%struct.QFont*, i32) + +declare i1 @_ZNK8QPrinter13collateCopiesEv(%struct.QPrinter*) + +declare i32 @_ZNK8QPrinter9numCopiesEv(%struct.QPrinter*) + +declare i32 @_ZNK8QPrinter8fromPageEv(%struct.QPrinter*) + +declare i32 @_ZNK8QPrinter6toPageEv(%struct.QPrinter*) + +declare i32 @_ZNK8QPrinter9pageOrderEv(%struct.QPrinter*) + +declare i32 @_ZNK8QPrinter12printerStateEv(%struct.QPrinter*) + +declare i1 @_ZN8QPrinter7newPageEv(%struct.QPrinter*) + +declare void @_ZN8QPainterD1Ev(%struct.QPainter*) diff --git a/test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll b/test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll deleted file mode 100644 index d35da8d..0000000 --- a/test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep call.*memcmp - -@.str = internal constant [2 x i8] c"x\00" - -declare i32 @strcmp(i8* %dest, i8* %src) - -define i32 @foo(i8* %x, i8* %y) { - %A = call i32 @strcmp(i8* %x, i8* getelementptr ([2 x i8]* @.str, i32 0, i32 0)) - ret i32 %A -} diff --git a/test/Transforms/TailCallElim/dont_reorder_load.ll b/test/Transforms/TailCallElim/dont_reorder_load.ll new file mode 100644 index 0000000..8fbe008 --- /dev/null +++ b/test/Transforms/TailCallElim/dont_reorder_load.ll @@ -0,0 +1,64 @@ +; RUN: llvm-as <%s | opt -tailcallelim | llvm-dis | grep call | count 3 +; PR4323 + +; Several cases where tail call elimination should not move the load above the +; call, and thus can't eliminate the tail recursion. + + +@extern_weak_global = extern_weak global i32 ; <i32*> [#uses=1] + + +; This load can't be safely moved above the call because the load is from an +; extern_weak global and may trap, but the call may unwind before that happens. +define fastcc i32 @no_tailrecelim_1(i32* %a_arg, i32 %a_len_arg, i32 %start_arg) readonly { +entry: + %tmp2 = icmp sge i32 %start_arg, %a_len_arg ; <i1> [#uses=1] + br i1 %tmp2, label %if, label %else + +if: ; preds = %entry + unwind + +else: ; preds = %entry + %tmp7 = add i32 %start_arg, 1 ; <i32> [#uses=1] + %tmp8 = call fastcc i32 @no_tailrecelim_1(i32* %a_arg, i32 %a_len_arg, i32 %tmp7) ; <i32> [#uses=1] + %tmp9 = load i32* @extern_weak_global ; <i32> [#uses=1] + %tmp10 = add i32 %tmp9, %tmp8 ; <i32> [#uses=1] + ret i32 %tmp10 +} + + +; This load can't be safely moved above the call because function may write to the pointer. +define fastcc i32 @no_tailrecelim_2(i32* %a_arg, i32 %a_len_arg, i32 %start_arg) nounwind { +entry: + %tmp2 = icmp sge i32 %start_arg, %a_len_arg ; <i1> [#uses=1] + br i1 %tmp2, label %if, label %else + +if: ; preds = %entry + store i32 1, i32* %a_arg; + ret i32 0; + +else: ; preds = %entry + %tmp7 = add i32 %start_arg, 1 ; <i32> [#uses=1] + %tmp8 = call fastcc i32 @no_tailrecelim_2(i32* %a_arg, i32 %a_len_arg, i32 %tmp7) ; <i32> [#uses=1] + %tmp9 = load i32* %a_arg ; <i32> [#uses=1] + %tmp10 = add i32 %tmp9, %tmp8 ; <i32> [#uses=1] + ret i32 %tmp10 +} + +; This load can't be safely moved above the call because that would change the +; order in which the volatile loads are performed. +define fastcc i32 @no_tailrecelim_3(i32* %a_arg, i32 %a_len_arg, i32 %start_arg) nounwind { +entry: + %tmp2 = icmp sge i32 %start_arg, %a_len_arg ; <i1> [#uses=1] + br i1 %tmp2, label %if, label %else + +if: ; preds = %entry + ret i32 0; + +else: ; preds = %entry + %tmp7 = add i32 %start_arg, 1 ; <i32> [#uses=1] + %tmp8 = call fastcc i32 @no_tailrecelim_3(i32* %a_arg, i32 %a_len_arg, i32 %tmp7) ; <i32> [#uses=1] + %tmp9 = volatile load i32* %a_arg ; <i32> [#uses=1] + %tmp10 = add i32 %tmp9, %tmp8 ; <i32> [#uses=1] + ret i32 %tmp10 +} diff --git a/test/Transforms/TailCallElim/reorder_load.ll b/test/Transforms/TailCallElim/reorder_load.ll new file mode 100644 index 0000000..aeb9042 --- /dev/null +++ b/test/Transforms/TailCallElim/reorder_load.ll @@ -0,0 +1,101 @@ +; RUN: llvm-as <%s | opt -tailcallelim | llvm-dis | not grep call +; PR4323 + +; Several cases where tail call elimination should move the load above the call, +; then eliminate the tail recursion. + + +@global = external global i32 ; <i32*> [#uses=1] +@extern_weak_global = extern_weak global i32 ; <i32*> [#uses=1] + + +; This load can be moved above the call because the function won't write to it +; and the call has no side effects. +define fastcc i32 @raise_load_1(i32* %a_arg, i32 %a_len_arg, i32 %start_arg) nounwind readonly { +entry: + %tmp2 = icmp sge i32 %start_arg, %a_len_arg ; <i1> [#uses=1] + br i1 %tmp2, label %if, label %else + +if: ; preds = %entry + ret i32 0 + +else: ; preds = %entry + %tmp7 = add i32 %start_arg, 1 ; <i32> [#uses=1] + %tmp8 = call fastcc i32 @raise_load_1(i32* %a_arg, i32 %a_len_arg, i32 %tmp7) ; <i32> [#uses=1] + %tmp9 = load i32* %a_arg ; <i32> [#uses=1] + %tmp10 = add i32 %tmp9, %tmp8 ; <i32> [#uses=1] + ret i32 %tmp10 +} + + +; This load can be moved above the call because the function won't write to it +; and the load provably can't trap. +define fastcc i32 @raise_load_2(i32* %a_arg, i32 %a_len_arg, i32 %start_arg) readonly { +entry: + %tmp2 = icmp sge i32 %start_arg, %a_len_arg ; <i1> [#uses=1] + br i1 %tmp2, label %if, label %else + +if: ; preds = %entry + ret i32 0 + +else: ; preds = %entry + %nullcheck = icmp eq i32* %a_arg, null ; <i1> [#uses=1] + br i1 %nullcheck, label %unwind, label %recurse + +unwind: ; preds = %else + unwind + +recurse: ; preds = %else + %tmp7 = add i32 %start_arg, 1 ; <i32> [#uses=1] + %tmp8 = call fastcc i32 @raise_load_2(i32* %a_arg, i32 %a_len_arg, i32 %tmp7) ; <i32> [#uses=1] + %tmp9 = load i32* @global ; <i32> [#uses=1] + %tmp10 = add i32 %tmp9, %tmp8 ; <i32> [#uses=1] + ret i32 %tmp10 +} + + +; This load can be safely moved above the call (even though it's from an +; extern_weak global) because the call has no side effects. +define fastcc i32 @raise_load_3(i32* %a_arg, i32 %a_len_arg, i32 %start_arg) nounwind readonly { +entry: + %tmp2 = icmp sge i32 %start_arg, %a_len_arg ; <i1> [#uses=1] + br i1 %tmp2, label %if, label %else + +if: ; preds = %entry + ret i32 0 + +else: ; preds = %entry + %tmp7 = add i32 %start_arg, 1 ; <i32> [#uses=1] + %tmp8 = call fastcc i32 @raise_load_3(i32* %a_arg, i32 %a_len_arg, i32 %tmp7) ; <i32> [#uses=1] + %tmp9 = load i32* @extern_weak_global ; <i32> [#uses=1] + %tmp10 = add i32 %tmp9, %tmp8 ; <i32> [#uses=1] + ret i32 %tmp10 +} + + +; The second load can be safely moved above the call even though it's from an +; unknown pointer (which normally means it might trap) because the first load +; proves it doesn't trap. +define fastcc i32 @raise_load_4(i32* %a_arg, i32 %a_len_arg, i32 %start_arg) readonly { +entry: + %tmp2 = icmp sge i32 %start_arg, %a_len_arg ; <i1> [#uses=1] + br i1 %tmp2, label %if, label %else + +if: ; preds = %entry + ret i32 0 + +else: ; preds = %entry + %nullcheck = icmp eq i32* %a_arg, null ; <i1> [#uses=1] + br i1 %nullcheck, label %unwind, label %recurse + +unwind: ; preds = %else + unwind + +recurse: ; preds = %else + %tmp7 = add i32 %start_arg, 1 ; <i32> [#uses=1] + %first = load i32* %a_arg ; <i32> [#uses=1] + %tmp8 = call fastcc i32 @raise_load_4(i32* %a_arg, i32 %first, i32 %tmp7) ; <i32> [#uses=1] + %second = load i32* %a_arg ; <i32> [#uses=1] + %tmp10 = add i32 %second, %tmp8 ; <i32> [#uses=1] + ret i32 %tmp10 +} |