summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimpleLoopUnswitch
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2019-07-10 08:25:48 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2019-07-10 08:25:48 +0000
commit97f19f3a4970b33c9ff2bc210ea4634a8bf0988e (patch)
treefe5d29235abc2a51adbd40c7e3da07e103580963 /llvm/test/Transforms/SimpleLoopUnswitch
parent625a0f70a9886d9f652a9c85b29c0e1765c17361 (diff)
downloadbcm5719-llvm-97f19f3a4970b33c9ff2bc210ea4634a8bf0988e.tar.gz
bcm5719-llvm-97f19f3a4970b33c9ff2bc210ea4634a8bf0988e.zip
[SimpleLoopUnswitch] Add a test case exposing a bug
This test exposes a bug in SimpleLoopUnswitch that leads to a crash on assert(SuccessorsCount > 1 && "Cannot unswitch a condition without multiple distinct successors!"); when SimpleLoopUnswitch considers unswitching of a loop by a switch with one successor. Fix will be submitted soon. Patch Author: Daniil Suchkov. Reviewers: reames, asbirlea, skatkov Reviewed By: skatkov Subscribers: zzheng, llvm-commits Differential Revision: https://reviews.llvm.org/D64403 llvm-svn: 365600
Diffstat (limited to 'llvm/test/Transforms/SimpleLoopUnswitch')
-rw-r--r--llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
new file mode 100644
index 00000000000..3624f5b9de6
--- /dev/null
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
@@ -0,0 +1,25 @@
+; REQUIRES: asserts
+; XFAIL: *
+; RUN: opt -passes='unswitch<nontrivial>' -disable-output -S < %s
+; RUN: opt -simple-loop-unswitch -enable-nontrivial-unswitch -disable-output -S < %s
+
+; This loop shouldn't trigger asserts in SimpleLoopUnswitch.
+define void @test_redundant_switch(i1* %ptr, i32 %cond) {
+entry:
+ br label %loop_begin
+
+loop_begin:
+ switch i32 %cond, label %loop_body [
+ i32 0, label %loop_body
+ ]
+
+loop_body:
+ br label %loop_latch
+
+loop_latch:
+ %v = load i1, i1* %ptr
+ br i1 %v, label %loop_begin, label %loop_exit
+
+loop_exit:
+ ret void
+}
OpenPOWER on IntegriCloud