[Bug tree-optimization/51938] missed optimization: 2 comparisons

marc.glisse at normalesup dot org gcc-bugzilla@gcc.gnu.org
Thu Jun 7 14:54:00 GMT 2012


Marc Glisse <marc.glisse at normalesup dot org> changed:

           What    |Removed                     |Added
          Component|rtl-optimization            |tree-optimization

--- Comment #4 from Marc Glisse <marc.glisse at normalesup dot org> 2012-06-07 14:54:02 UTC ---
Changing to tree-optimization (doing the optimization at RTL level would
require finite-math-only).

There is plenty of code that corresponds to A&&B and A||B, but (almost) nothing
for A&&!B. Quite a big missing piece...

<bb 2>:
  if (x_2(D) > 0.0)
    goto <bb 5>;
    goto <bb 3>;

<bb 3>:
  if (x_2(D) < 0.0)
    goto <bb 4>;
    goto <bb 5>;

The 2 conditions don't share the same then branch or the same else branch (it
is a mix), so ifcombine doesn't even try to turn it into

  if (x_2(D) > 0.0 || !(x_2(D) < 0.0))
    goto <bb 5>;
    goto <bb 4>;

Besides, it doesn't look like the logic is in place to fold that condition into
just its second half (but I may have missed it).

More information about the Gcc-bugs mailing list