Prevent loop-unroll from making assumptions about undefined behavior.
authorAndrew Trick <atrick@apple.com>
Fri, 31 May 2013 23:34:46 +0000 (23:34 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 31 May 2013 23:34:46 +0000 (23:34 +0000)
commitcd8e3c4dcf4383b8b1c16827c6326f6e9bc49d51
treeb4d46daf05abe3486696c534b2c752e15809baf8
parent34431085def8f67db07ccb7485138176bba5a90a
Prevent loop-unroll from making assumptions about undefined behavior.

Fixes rdar:14036816, PR16130.

There is an opportunity to compute precise trip counts for 'or'
expressions and multi-exit loops.
rdar:14038809: Optimize trip count computation for multi-exit loops.

To do this we need to record the fact that ExitLimit assumes NSW. When
it does not we can safely assume that the loop trip count is the
minimum ExitLimt across all subexpressions and loop exits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183060 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Transforms/LoopUnroll/scevunroll.ll
test/Transforms/LoopUnroll/unloop.ll