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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
tree-ssa-threadedge.c has some BUILT_IN_CONSTANT_P code already, but clearly it
isn't enough.
"Similarly for __builtin_constant_p:

r = PHI <1(2), 2(3)>
__builtin_constant_p (r)

Both PHI arguments are constant, but x ? 1 : 2 is still not
constant."
is what it does right now, but we have instead:
  # iftmp.0_2 = PHI <a.1_5(2), 1(3)>
  b = iftmp.0_2;
  _1 = __builtin_constant_p (iftmp.0_2);
where thread1 turns it into:
  # iftmp.0_8 = PHI <1(2)>
  b = iftmp.0_8;
  _10 = __builtin_constant_p (iftmp.0_8);
...
  # iftmp.0_2 = PHI <a.1_5(2)>
  b = iftmp.0_2;
  _1 = __builtin_constant_p (iftmp.0_2);
This is undesirable, iftmp.0_2 really isn't constant, so we shouldn't turn it
into sometimes constant, sometimes non-constant.

Reply via email to