Teach SCEV's icmp simplification logic that a-b == 0 is equivalent to a == b.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 30 May 2012 18:32:23 +0000 (18:32 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 30 May 2012 18:32:23 +0000 (18:32 +0000)
commit6cf07a80ff5ee8ef7dc336f954aae17c7e8d83d4
treea47c39f352c87564a19069dc27f70320e4611319
parentf186df0d3e64d1b6f61da39ce882530bf387029e
Teach SCEV's icmp simplification logic that a-b == 0 is equivalent to a == b.

This also required making recursive simplifications until
nothing changes or a hard limit (currently 3) is hit.

With the simplification in place indvars can canonicalize
loops of the form
for (unsigned i = 0; i < a-b; ++i)
into
for (unsigned i = 0; i != a-b; ++i)
which used to fail because SCEV created a weird umax expr
for the backedge taken count.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157701 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
test/Transforms/IndVarSimplify/ult-sub-to-eq.ll [new file with mode: 0644]