summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-07-12 03:53:05 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-07-12 03:53:05 +0000
commit6bc83e0f430bcfd798561815778f4777801fc4f8 (patch)
tree05b36746f9d964fb2fb2cecc3b73ea5d1433120f /llvm/test/Transforms
parent305fa9c2bfcd847171a1680a3b1b9ae69451ab26 (diff)
downloadbcm5719-llvm-6bc83e0f430bcfd798561815778f4777801fc4f8.tar.gz
bcm5719-llvm-6bc83e0f430bcfd798561815778f4777801fc4f8.zip
[LICM] Don't try to sink values out of loops without any exits
There is no suitable basic block to sink instructions in loops without exits. The only way an instruction in a loop without exits can be used is as an incoming value to a PHI. In such cases, the incoming block for the corresponding value is unreachable. This fixes PR24013. Differential Revision: http://reviews.llvm.org/D10903 llvm-svn: 241987
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/LICM/PR24013.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LICM/PR24013.ll b/llvm/test/Transforms/LICM/PR24013.ll
new file mode 100644
index 00000000000..4557bfcfd12
--- /dev/null
+++ b/llvm/test/Transforms/LICM/PR24013.ll
@@ -0,0 +1,19 @@
+; RUN: opt -licm -S < %s | FileCheck %s
+
+define void @f(i1 zeroext %p1) {
+; CHECK-LABEL: @f(
+entry:
+ br label %lbl
+
+lbl.loopexit: ; No predecessors!
+ br label %lbl
+
+lbl: ; preds = %lbl.loopexit, %entry
+ %phi = phi i32 [ %conv, %lbl.loopexit ], [ undef, %entry ]
+; CHECK: phi i32 [ undef, {{.*}} ], [ undef
+ br label %if.then.5
+
+if.then.5: ; preds = %if.then.5, %lbl
+ %conv = zext i1 undef to i32
+ br label %if.then.5
+}
OpenPOWER on IntegriCloud