This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/87954] VRP can transform a * b where a,b are [0,1] to a & b


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87954

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-11-09
     Ever confirmed|0                           |1

--- Comment #1 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Indeed, if you compile imul() with -fdump-tree-all-details-alias -O2 and look
at the vrp1 dump, one can see:

  # RANGE [0, 1] NONZERO 1
  is_rec_12 = (int) _4;
...
  # RANGE [0, 1] NONZERO 1
  _6 = (int) _15;
  # RANGE [0, 1] NONZERO 1
  _7 = _6 * is_rec_12;

This pattern persists throughout the optimization pipeline, so any remaining
optimizer could potentially see the range of the operands and strength reduce
this.

What would be the best place to do this?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]