[InstSimplify] fold min/max with matching min/max operands
authorSanjay Patel <spatel@rotateright.com>
Tue, 11 Aug 2020 12:08:46 +0000 (08:08 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 11 Aug 2020 15:23:15 +0000 (11:23 -0400)
commit1470ce4a76fc56729fb15dab0ca9877e25d26d58
tree3688330498275dc95bf5b54caed7c6a6bae51832
parentbad205fe0c742d956246b8b59305e783694d2ae2
[InstSimplify] fold min/max with matching min/max operands

I think this is the last remaining translation of an existing
instcombine transform for the corresponding cmp+sel idiom.

This interpretation is more general though - we can remove
mismatched signed/unsigned combinations in addition to the
more obvious cases.

min/max(X, Y) must produce X or Y as the result, so this is
just another clause in the existing transform that was already
matching a min/max of min/max.
llvm/include/llvm/IR/PatternMatch.h
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/maxmin_intrinsics.ll