summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimpleLoopUnswitch
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2018-04-23 06:58:36 +0000
committerChandler Carruth <chandlerc@gmail.com>2018-04-23 06:58:36 +0000
commitbf7190a15470adb31f8df08aa9d61bb2861e7d54 (patch)
tree0d0bfd116ce1746ca7591b59b880db5464d51059 /llvm/test/Transforms/SimpleLoopUnswitch
parent3f1d53816549f4073f73f8cedc36665b1f70df40 (diff)
downloadbcm5719-llvm-bf7190a15470adb31f8df08aa9d61bb2861e7d54.tar.gz
bcm5719-llvm-bf7190a15470adb31f8df08aa9d61bb2861e7d54.zip
[PM/LoopUnswitch] Remove a buggy assert in the new loop unswitch.
The condition this was asserting doesn't actually hold. I've added comments to explain why, removed the assert, and added a fun test case reduced out of 403.gcc. llvm-svn: 330564
Diffstat (limited to 'llvm/test/Transforms/SimpleLoopUnswitch')
-rw-r--r--llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll55
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
+}
OpenPOWER on IntegriCloud