[ValueTracking] Add a framework for encoding implication rules
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 6 Nov 2015 19:00:57 +0000 (19:00 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 6 Nov 2015 19:00:57 +0000 (19:00 +0000)
commit772fb1e0b6b35124311f875f12689bb6ca71a29f
tree704ee680a7641989541b70104ea13a91b53a9b19
parentabe916ea5c1deeb54829baecd8d0a5448d26ded0
[ValueTracking] Add a framework for encoding implication rules

Summary:
This change adds a framework for adding more smarts to
`isImpliedCondition` around inequalities.  Informally,
`isImpliedCondition` will now try to prove "A < B ==> C < D" by proving
"C <= A && B <= D", since then it follows "C <= A < B <= D".

While this change is in principle NFC, I could not think of a way to not
handle cases like "i +_nsw 1 < L ==> i < L +_nsw 1" (that ValueTracking
did not handle before) while keeping the change understandable.  I've
added tests for these cases.

Reviewers: reames, majnemer, hfinkel

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14368

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252331 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/InstSimplify/implies.ll