[PATCH] Added instcombine for 'ABS(ABS(X)) -> ABS(X)'

Dinesh Dwivedi dinesh.d at samsung.com
Thu May 15 23:42:55 PDT 2014


Thanks Jasper,

Yes, that's a typo, correcting it. I meant (X < 1) ? -X : X.
After going though code and trying lots of test examples, 
I assume, we do not have to check for (>=, <=) are they 
are always get transformed to corresponding (>, <).

Regards
Dinesh Dwivedi

------- Original Message -------
Sender : Jasper Neumann<jn at sirrida.de> 
Date   : May 16, 2014 12:03 (GMT+05:30)
Title  : Re: [PATCH] Added instcombine for 'ABS(ABS(X)) -> ABS(X)'

Hello Dinesh, hello folks!

> updated code to handle following patterns [Thanks for pointing out]
>    // (X > 0) ? X : -X
>    // (X < 0) ? -X : X
>    // (X > 1) ? -X : X

The last line looks incorrect to me. I think it should be
   (X >= 1) ? -X : X
and/or
   (X > 0) ? -X : X
and/or
   (X >= 0) ? -X : X
and/or
   (X > -1) ? -X : X

Best regards
Jasper




More information about the llvm-commits mailing list