https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89723
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic,
| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-03-15
Blocks| |24639
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
[CHECK]: examining phi: _10 = PHI <0(13), 0(10), ki_8(14), ki_9(15)>
[CHECK]: Found unguarded use: return _10;
<bb 2> [local count: 116465650]:
if (r_11(D) == 0B)
goto <bb 10>; [18.09%]
else
goto <bb 8>; [81.91%]
<bb 10> [local count: 21068636]:
goto <bb 7>; [100.00%]
<bb 8> [local count: 95397014]:
goto <bb 6>; [100.00%]
...
<bb 6> [local count: 1073741824]:
# index_6 = PHI <index_12(D)(8), index_5(9)>
# n_7 = PHI <r_11(D)(8), _4(9)>
# ki_9 = PHI <ki_13(D)(8), ki_8(9)>
if (n_7 != 0B)
goto <bb 3>; [96.34%]
else
goto <bb 15>; [3.66%]
<bb 15> [local count: 39298952]:
<bb 7> [local count: 116465651]:
# _10 = PHI <0(13), 0(10), ki_8(14), ki_9(15)>
return _10;
so the issue is we fail to jump-thread the condition in BB 6 (fail to
eliminate the loop header test). This is because with -Og we do not
perform any jump threading.
We might want to change this but at -Og we definitely do not want to
duplicate blocks.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues