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

Jasper Neumann jn at sirrida.de
Thu May 15 23:33:39 PDT 2014


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