aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-12-08 23:44:46 +0000
committerDevang Patel <dpatel@apple.com>2008-12-08 23:44:46 +0000
commit51d8b669f16308c61ab920c0ab3e0ac83f494ba1 (patch)
tree87f75748053fda34a785b39350f4a9ee3ce09aaf
parent20fa76ef6f7c2d3073e0960cf347af8db64708fc (diff)
Actually test something. Use PR3170 test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60727 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll61
1 files changed, 25 insertions, 36 deletions
diff --git a/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
index 3bc57265ce..383aa5b671 100644
--- a/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
+++ b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
@@ -1,47 +1,36 @@
-; RUN: llvm-as < %s | opt -loop-unswitch -verify -disable-output
-
-
-define void @test_fc_while_continue_or(float %x, float %y, float* %result) nounwind {
+; RUN: llvm-as < %s | opt -loop-unswitch -stats -disable-output |& grep "1 loop-unswitch - Number of branches unswitched" | count 1
+; PR 3170
+define i32 @a(i32 %x, i32 %y) nounwind {
entry:
- br label %bb2.outer
+ %0 = icmp ult i32 0, %y ; <i1> [#uses=1]
+ br i1 %0, label %bb.nph, label %bb4
+
+bb.nph: ; preds = %entry
+ %1 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br label %bb
-bb: ; preds = %bb2
- %0 = add float %5, %z.0 ; <float> [#uses=3]
- %1 = fcmp oeq float %0, 0.000000e+00 ; <i1> [#uses=1]
+bb: ; preds = %bb.nph, %bb3
+ %i.01 = phi i32 [ %3, %bb3 ], [ 0, %bb.nph ] ; <i32> [#uses=1]
br i1 %1, label %bb2, label %bb1
bb1: ; preds = %bb
- %.lcssa = phi float [ %0, %bb ] ; <float> [#uses=1]
- %z.0.lcssa1 = phi float [ %z.0, %bb ] ; <float> [#uses=0]
- %2 = add float %x_addr.0.ph, 1.000000e+00 ; <float> [#uses=1]
- br label %bb2.outer
-
-bb2.outer: ; preds = %bb1, %entry
- %z.0.ph = phi float [ 0.000000e+00, %entry ], [ %.lcssa, %bb1 ] ; <float> [#uses=1]
- %x_addr.0.ph = phi float [ %x, %entry ], [ %2, %bb1 ] ; <float> [#uses=3]
- %3 = fcmp une float %x_addr.0.ph, 0.000000e+00 ; <i1> [#uses=1]
- %4 = fcmp une float %y, 0.000000e+00 ; <i1> [#uses=1]
- %or.cond = or i1 %3, %4 ; <i1> [#uses=1]
- %5 = mul float %x_addr.0.ph, %y ; <float> [#uses=1]
+ %2 = tail call i32 (...)* @b() nounwind ; <i32> [#uses=0]
br label %bb2
-bb2: ; preds = %bb2.outer, %bb
- %z.0 = phi float [ %0, %bb ], [ %z.0.ph, %bb2.outer ] ; <float> [#uses=3]
- br i1 %or.cond, label %bb, label %bb4
+bb2: ; preds = %bb, %bb1
+ %3 = add i32 %i.01, 1 ; <i32> [#uses=2]
+ br label %bb3
-bb4: ; preds = %bb2
- %z.0.lcssa = phi float [ %z.0, %bb2 ] ; <float> [#uses=1]
- store float %z.0.lcssa, float* %result, align 4
- ret void
-}
+bb3: ; preds = %bb2
+ %i.0 = phi i32 [ %3, %bb2 ] ; <i32> [#uses=1]
+ %4 = icmp ult i32 %i.0, %y ; <i1> [#uses=1]
+ br i1 %4, label %bb, label %bb3.bb4_crit_edge
-define i32 @main() nounwind {
-entry:
- %z = alloca [10 x i32] ; <[10 x i32]*> [#uses=2]
- %0 = call i32 (...)* @test_fc_while_or(i32 0, i32 0, [10 x i32]* %z) nounwind ; <i32> [#uses=0]
- %1 = getelementptr [10 x i32]* %z, i32 0, i32 0 ; <i32*> [#uses=1]
- %2 = load i32* %1, align 4 ; <i32> [#uses=1]
- ret i32 %2
+bb3.bb4_crit_edge: ; preds = %bb3
+ br label %bb4
+
+bb4: ; preds = %bb3.bb4_crit_edge, %entry
+ ret i32 0
}
-declare i32 @test_fc_while_or(...)
+declare i32 @b(...)