OSDN Git Service

Improve clamp recognition in ValueTracking.
authorNikolai Bozhenov <nikolai.bozhenov@intel.com>
Tue, 17 Oct 2017 11:50:48 +0000 (11:50 +0000)
committerNikolai Bozhenov <nikolai.bozhenov@intel.com>
Tue, 17 Oct 2017 11:50:48 +0000 (11:50 +0000)
commit12367d94353605953c2b67fd9d0f69f3e5f81b95
tree3562767263a902a9fb5db4234829bf86c4b321ce
parente60981b45458149e8cdd4dc18246d95835c17cc8
Improve clamp recognition in ValueTracking.

Summary:
ValueTracking was recognizing not all variations of clamp. Swapping of
true value and false value of select was added to fix this problem. This
change breaks the canonical form of cmp inside the matchMinMax function,
that is why additional checks for compare predicates is needed. Added
corresponding test cases.

Reviewers: spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D38531

Patch by: Artur Gainullin <artur.gainullin@intel.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315992 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/InstCombine/minmax-fold.ll