[Bug tree-optimization/106138] Inefficient code generation for cases when results can be deduced at compile time

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 30 07:26:02 GMT 2022


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

           What    |Removed                     |Added
                 CC|                            |amacleod at redhat dot com

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we're seeing

  b1_8 = x_7(D) == 4;
  # RANGE [0, 3] NONZERO 3
  _3 = x_7(D) & 3;
  b2_9 = _3 != 0;
  _5 = b1_8 & b2_9;

and fail to optimize that.  It somewhat looks like "relations" (on x_7), but
I'm not sure if suitable to handle for ranger.

Adding something in match.pd might be possible - the key is of course that
both b1 and b2 are derived from the same value.  I think we already have
a pattern looking at not intersecting nonzero bits.

More information about the Gcc-bugs mailing list