[PATCH] Teach Instcombine to use the nsw attribute for signed comparisons to 0 of (shl %v, Cst) or (mul %v, Cst)
Duncan Sands
baldrick at free.fr
Mon Mar 18 03:40:03 PDT 2013
Hi Arnaud,
On 17/03/13 18:11, Arnaud de Grandmaison wrote:
> The attached patch teaches InstCombine/visitICmpInstWithInstAndIntCst to
> optimize 'icmp pred (mul %v, Cst), 0' when the mul has the nsw attribute set.
> The comparison can the be performed on the mul RHS.
>
> The patch also handles the case of the mul in strength reduced form : shl
it looks like this will transform
%mul = mul nsw i32 %x, 0
%cmp = icmp sgt i32 %mul, 0
into
icmp sgt i32 %x, 0
which is wrong.
Ciao, Duncan.
More information about the llvm-commits
mailing list