diff options
Diffstat (limited to 'llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll')
-rw-r--r-- | llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll index 651ba19c427..e181bc5ba19 100644 --- a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll +++ b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll @@ -2380,3 +2380,58 @@ loop_latch: loop_exit: ret void } + +; A test reduced out of 403.gcc with interesting nested loops that trigger +; multiple unswitches. A key component of this test is that there are multiple +; paths to reach an inner loop after unswitching, and one of them is via the +; predecessors of the unswitched loop header. That can allow us to find the loop +; through multiple different paths. +define void @test21(i1 %a, i1 %b) { +; CHECK-LABEL: @test21( +bb: + br label %bb3 +; CHECK-NOT: br i1 %a +; +; CHECK: br i1 %a, label %[[BB_SPLIT_US:.*]], label %[[BB_SPLIT:.*]] +; +; CHECK-NOT: br i1 %a +; CHECK-NOT: br i1 %b +; +; CHECK: [[BB_SPLIT]]: +; CHECK: br i1 %b +; +; CHECK-NOT: br i1 %a +; CHECK-NOT: br i1 %b + +bb3: + %tmp1.0 = phi i32 [ 0, %bb ], [ %tmp1.3, %bb23 ] + br label %bb7 + +bb7: + %tmp.0 = phi i1 [ true, %bb3 ], [ false, %bb19 ] + %tmp1.1 = phi i32 [ %tmp1.0, %bb3 ], [ %tmp1.2.lcssa, %bb19 ] + br i1 %tmp.0, label %bb11.preheader, label %bb23 + +bb11.preheader: + br i1 %a, label %bb19, label %bb14.lr.ph + +bb14.lr.ph: + br label %bb14 + +bb14: + %tmp2.02 = phi i32 [ 0, %bb14.lr.ph ], [ 1, %bb14 ] + br i1 %b, label %bb11.bb19_crit_edge, label %bb14 + +bb11.bb19_crit_edge: + %split = phi i32 [ %tmp2.02, %bb14 ] + br label %bb19 + +bb19: + %tmp1.2.lcssa = phi i32 [ %split, %bb11.bb19_crit_edge ], [ %tmp1.1, %bb11.preheader ] + %tmp21 = icmp eq i32 %tmp1.2.lcssa, 0 + br i1 %tmp21, label %bb23, label %bb7 + +bb23: + %tmp1.3 = phi i32 [ %tmp1.2.lcssa, %bb19 ], [ %tmp1.1, %bb7 ] + br label %bb3 +} |