[Bug tree-optimization/81741] Misoptimisation : replacing a constant field read access by a function call

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 8 07:32:00 GMT 2017


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-08-08
                 CC|                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm quite sure it is because of propagating a conditional equivalence.

-fno-tree-dominator-opts fixes this (it's the only pass doing this kind of
propagation IIRC).

  <bb 2> [100.00%]:
  _1 = s_5(D)->ptr;
  _2 = strlen (_1);
  _3 = s_5(D)->size;
  if (_2 != _3)
    goto <bb 3>; [0.04%]
  else
    goto <bb 4>; [99.96%]

  <bb 3> [0.04%]:
  __builtin_unreachable ();

  <bb 4> [99.96%]:
  _6 = (int) _3;
  return _6;

here DOM decides well, on the else path _2 == _3 so let's propagate!

IMHO we _never_ should propagate (non-constant) conditional equivalences.


More information about the Gcc-bugs mailing list