Merging r258184:
authorSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 26 Jan 2016 22:29:46 +0000 (22:29 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 26 Jan 2016 22:29:46 +0000 (22:29 +0000)
commit44fb5881d8edf448d6231a5b8df583aecd6bcd42
tree4d3a6ff5ad6af252c59648b0e13bfabd51806dcb
parent4d1ef71f362e014aaaaefeb36abe83c24b578e40
Merging r258184:
------------------------------------------------------------------------
r258184 | sanjoy | 2016-01-19 12:53:51 -0800 (Tue, 19 Jan 2016) | 20 lines

[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
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@258869 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
test/Transforms/IndVarSimplify/pr26207.ll [new file with mode: 0644]