summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/IndVarSimplify
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-10-31 23:21:40 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-10-31 23:21:40 +0000
commit337d4786e1532b3545f3e58b6844aaade713afbd (patch)
treeee38e7b35eea6006a0cd654f7e9b62dd24971178 /llvm/test/Transforms/IndVarSimplify
parentf25d25a156ab3b7b4db2fe7daca314b85a98adcb (diff)
downloadbcm5719-llvm-337d4786e1532b3545f3e58b6844aaade713afbd.tar.gz
bcm5719-llvm-337d4786e1532b3545f3e58b6844aaade713afbd.zip
[SCEV] Don't create SCEV expressions that break LCSSA
Prevent `createNodeFromSelectLikePHI` from creating SCEV expressions that break LCSSA. A better fix for the same issue is to teach SCEVExpander to not break LCSSA by inserting PHI nodes at appropriate places. That's planned for the future. Fixes PR25360. llvm-svn: 251756
Diffstat (limited to 'llvm/test/Transforms/IndVarSimplify')
-rw-r--r--llvm/test/Transforms/IndVarSimplify/pr25360.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/pr25360.ll b/llvm/test/Transforms/IndVarSimplify/pr25360.ll
new file mode 100644
index 00000000000..9f6df7051ea
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/pr25360.ll
@@ -0,0 +1,33 @@
+; RUN: opt -indvars -S < %s | FileCheck %s
+
+
+; Ensure that does not crash
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f() {
+; CHECK-LABEL: @f(
+entry:
+ br label %for.end
+
+for.condt: ; preds = %for.end
+ br i1 true, label %for.cond.0, label %for.end
+
+for.end: ; preds = %for.body.3
+ %inc = select i1 undef, i32 2, i32 1
+ br i1 false, label %for.condt, label %for.cond.0
+
+for.cond.0: ; preds = %for.end, %for.condt
+ %init = phi i32 [ 0, %for.condt ], [ %inc, %for.end ]
+ br i1 true, label %for.end.13, label %for.body.9
+
+for.body.9: ; preds = %for.body.9, %for.cond.0
+ %p1.addr.22 = phi i32 [ %inc10, %for.body.9 ], [ %init, %for.cond.0 ]
+ %inc10 = add i32 %p1.addr.22, 1
+ br i1 true, label %for.end.13, label %for.body.9
+
+for.end.13: ; preds = %for.cond.7.for.end.13_crit_edge, %for.cond.0
+ %p1.addr.2.lcssa = phi i32 [ %inc10, %for.body.9 ], [ %init, %for.cond.0 ]
+ ret void
+}
OpenPOWER on IntegriCloud