[InstCombine] (icmp sgt smin(PosA, B) 0) -> (icmp sgt B 0)
authorPhilip Reames <listmail@philipreames.com>
Wed, 9 Mar 2016 21:05:07 +0000 (21:05 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 9 Mar 2016 21:05:07 +0000 (21:05 +0000)
commitec8a8b54379c1f4fef5233eed9b75bf12f4fdba1
treee7327bcd4b109127fbd7823fbd690f05b8540e78
parent660748ca8c70e3afd8414ff45ef99feeca3f3d3c
[InstCombine] (icmp sgt smin(PosA, B) 0) -> (icmp sgt B 0)

When checking whether an smin is positive, we can move the comparison to one of the inputs if the other is known positive. If the known positive one is the min, then the other can't be negative. If the other is the min, then we compute the min.

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

llvm-svn: 263059
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/min-positive.ll [new file with mode: 0644]