[Bug tree-optimization/56223] Integer ABS is not recognized for more complicated pattern

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 6 12:15:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56223

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-06
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-06 12:14:54 UTC ---
Related support is in tree-ssa-phiopt.c which simply doesn't consider this
more complex pattern.  A changed pattern detection could detect


  if (v >= 0)
    use +v
    ...
  else
    use -v
    ...

  v unused outside the if

and replace it with

  v' = abs (v);
  if (v >= 0)
    use v'
    ...
  else
    use v'
    ...

and hope for further optimizations to detect the equivalences.

Or special-case a single addition / subtraction statement here.



More information about the Gcc-bugs mailing list