[SCEV] Reapply 'Exploit A < B => (A+K) < (B+K) when possible'
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 25 Sep 2015 23:53:45 +0000 (23:53 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 25 Sep 2015 23:53:45 +0000 (23:53 +0000)
commitf0841dc6483dbba0585f2b21dbd98b7eb33b8ed7
treee00dea3a815b0e9613bddfabcb7bf56151826b0b
parenta882dfa6b7b75a88abcbeaa28c951c563bd423c2
[SCEV] Reapply 'Exploit A < B => (A+K) < (B+K) when possible'

Summary:

This change teaches SCEV's `isImpliedCond` two new identities:

  A u< B u< -C          =>  (A + C) u< (B + C)
  A s< B s< INT_MIN - C =>  (A + C) s< (B + C)

While these are useful on their own, they're really intended to support
D12950.

The original checkin, r248606 had to be backed out due to an issue with
a ObjCXX unit test.  That issue is now fixed, so re-landing.

Reviewers: atrick, reames, majnemer, nlewycky, hfinkel

Subscribers: aadg, sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248637 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
test/Transforms/IndVarSimplify/eliminate-comparison.ll