summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-01-19 20:53:51 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-01-19 20:53:51 +0000
commit29a4b5dc0d754c9a45f62a8af0cc36e8de4f968d (patch)
treec1db3e48b0d1ca4c0ef7901a5fc6447c24f6e475 /llvm/test/Transforms
parent0ff078736f77aa204126bd214f35defece4e68ca (diff)
downloadbcm5719-llvm-29a4b5dc0d754c9a45f62a8af0cc36e8de4f968d.tar.gz
bcm5719-llvm-29a4b5dc0d754c9a45f62a8af0cc36e8de4f968d.zip
[SCEV] Fix PR26207
In some cases, the max backedge taken count can be more conservative than the exact backedge taken count (for instance, because ScalarEvolution::getRange is not control-flow sensitive whereas computeExitLimitFromICmp can be). In these cases, computeExitLimitFromCond (specifically the bit that deals with `and` and `or` instructions) can create an ExitLimit instance with a `SCEVCouldNotCompute` max backedge count expression, but a computable exact backedge count expression. This violates an implicit SCEV assumption: a computable exact BE count should imply a computable max BE count. This change - Makes the above implicit invariant explicit by adding an assert to ExitLimit's constructor - Changes `computeExitLimitFromCond` to be more robust around conservative max backedge counts llvm-svn: 258184
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/IndVarSimplify/pr26207.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/pr26207.ll b/llvm/test/Transforms/IndVarSimplify/pr26207.ll
new file mode 100644
index 00000000000..9d351e09857
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/pr26207.ll
@@ -0,0 +1,20 @@
+; RUN: opt -S -indvars < %s | FileCheck %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @main(i16 %in) {
+; CHECK-LABEL: @main(
+ br label %bb2
+
+bb2: ; preds = %bb1.i, %bb2, %0
+ %_tmp44.i = icmp slt i16 %in, 2
+ br i1 %_tmp44.i, label %bb1.i, label %bb2
+
+bb1.i: ; preds = %bb1.i, %bb2
+ %_tmp25.i = phi i16 [ %in, %bb2 ], [ %_tmp6.i, %bb1.i ]
+ %_tmp6.i = add nsw i16 %_tmp25.i, 1
+ %_tmp10.i = icmp sge i16 %_tmp6.i, 2
+ %exitcond.i = icmp eq i16 %_tmp6.i, 2
+ %or.cond = and i1 %_tmp10.i, %exitcond.i
+ br i1 %or.cond, label %bb2, label %bb1.i
+}
OpenPOWER on IntegriCloud