OSDN Git Service

[InstCombine] add folds for icmp (smin X, Y), X
authorSanjay Patel <spatel@rotateright.com>
Thu, 15 Dec 2016 19:13:37 +0000 (19:13 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 15 Dec 2016 19:13:37 +0000 (19:13 +0000)
commit8ca87b1e6e42d1702e67c5796729ac8c12d2cc58
tree7920e22cb03704b0879c2fe27dacf7d51284fc7e
parent36850aafe28023e5ac0ad52abf0997c152ec7e95
[InstCombine] add folds for icmp (smin X, Y), X

Min/max canonicalization (r287585) exposes the fact that we're missing combines for min/max patterns.
This patch won't solve the example that was attached to that thread, so something else still needs fixing.

The line between InstCombine and InstSimplify gets blurry here because sometimes the icmp instruction that
we want to fold to already exists, but sometimes it's the swapped form of what we want.

Corresponding changes for smax/umin/umax to follow.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289855 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/PatternMatch.h
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/smin-icmp.ll