From 265ca5dff5ad21add569fadab435f64423861793 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 3 Nov 2008 19:38:07 +0000 Subject: Ignore conditions that are outside the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58631 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../LoopUnswitch/2008-11-03-Invariant.ll | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll (limited to 'test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll') diff --git a/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll new file mode 100644 index 0000000..430ada4 --- /dev/null +++ b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll @@ -0,0 +1,47 @@ +; RUN: llvm-as < %s | opt -loop-unswitch -stats | not grep loop-unswitch + + +define void @test_fc_while_continue_or(float %x, float %y, float* %result) nounwind { +entry: + br label %bb2.outer + +bb: ; preds = %bb2 + %0 = add float %5, %z.0 ; [#uses=3] + %1 = fcmp oeq float %0, 0.000000e+00 ; [#uses=1] + br i1 %1, label %bb2, label %bb1 + +bb1: ; preds = %bb + %.lcssa = phi float [ %0, %bb ] ; [#uses=1] + %z.0.lcssa1 = phi float [ %z.0, %bb ] ; [#uses=0] + %2 = add float %x_addr.0.ph, 1.000000e+00 ; [#uses=1] + br label %bb2.outer + +bb2.outer: ; preds = %bb1, %entry + %z.0.ph = phi float [ 0.000000e+00, %entry ], [ %.lcssa, %bb1 ] ; [#uses=1] + %x_addr.0.ph = phi float [ %x, %entry ], [ %2, %bb1 ] ; [#uses=3] + %3 = fcmp une float %x_addr.0.ph, 0.000000e+00 ; [#uses=1] + %4 = fcmp une float %y, 0.000000e+00 ; [#uses=1] + %or.cond = or i1 %3, %4 ; [#uses=1] + %5 = mul float %x_addr.0.ph, %y ; [#uses=1] + br label %bb2 + +bb2: ; preds = %bb2.outer, %bb + %z.0 = phi float [ %0, %bb ], [ %z.0.ph, %bb2.outer ] ; [#uses=3] + br i1 %or.cond, label %bb, label %bb4 + +bb4: ; preds = %bb2 + %z.0.lcssa = phi float [ %z.0, %bb2 ] ; [#uses=1] + store float %z.0.lcssa, float* %result, align 4 + ret void +} + +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 ; [#uses=0] + %1 = getelementptr [10 x i32]* %z, i32 0, i32 0 ; [#uses=1] + %2 = load i32* %1, align 4 ; [#uses=1] + ret i32 %2 +} + +declare i32 @test_fc_while_or(...) -- cgit v1.1