https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80155
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-03-23
Target Milestone|--- |7.0
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Code-hoisting triggers a latent pessimization PRE performs:
Transform:
<bb 3> [85.00%]:
# a_14 = PHI <a_10(8), a_5(D)(7)>
if (b_7(D) != 0)
goto <bb 4>; [50.00%]
else
goto <bb 10>; [50.00%]
<bb 10> [42.50%]:
goto <bb 5>; [100.00%]
<bb 4> [42.50%]:
a_8 = a_14 + 1;
<bb 5> [85.00%]:
# a_2 = PHI <a_14(10), a_8(4)>
fn2 ();
a_10 = a_2 + 1;
to
<bb 3> [85.00%]:
# a_14 = PHI <prephitmp_12(5), a_5(D)(2)>
_4 = a_14 + 1;
if (b_7(D) != 0)
goto <bb 4>; [50.00%]
else
goto <bb 5>; [50.00%]
<bb 4> [42.50%]:
_3 = _4 + 1;
<bb 5> [85.00%]:
# a_2 = PHI <a_14(3), _4(4)>
# prephitmp_12 = PHI <_4(3), _3(4)>
fn2 ();
that's because the hoisting (which itself isn't a problem) makes
a_2 + 1 partially redundant over the latch. We see this issue
in related testcases where PRE can compute a constant for the
first iteration value of expressions and thus inserts IVs for
them. So it's nothing new and a fix would hopefully fix those
cases as well.