Fix for PR2607: SCEV miscomputing the loop count for loops with an
authorEli Friedman <eli.friedman@gmail.com>
Wed, 30 Jul 2008 00:04:08 +0000 (00:04 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 30 Jul 2008 00:04:08 +0000 (00:04 +0000)
commit068acc3caa113db0925766d327bf9cae6a9eb885
tree7524c7a6deaf316b4e11ee78b453fcf0b50059f8
parent83ea1f8e19dc1fae54a3e40689ad0a76a8ff3992
Fix for PR2607: SCEV miscomputing the loop count for loops with an
SGT exit condition.  Essentially, the correct way to flip an inequality
in 2's complement is the not operator, not the negation operator.
That said, the difference only affects cases involving INT_MIN.

Also, enhance the pre-test search logic to be a bit smarter about
inequalities flipped with a not operator, so it can eliminate the smax
from the iteration count for simple loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54184 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/2008-07-29-SGTTripCount.ll [new file with mode: 0644]