[Bug tree-optimization/96187] GCC at -O2 generates branch for code that should be branch-free
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 14 06:56:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96187
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Host|x86_64 |
Status|UNCONFIRMED |NEW
Target|x86_64 |x86_64-*-*
Keywords| |missed-optimization
Ever confirmed|0 |1
Last reconfirmed| |2020-07-14
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. The issue seems to be PRE removing the RTL if-conversion
opportunity by eliding the final bitwise OR on the path with a literal zero:
_2 = MEM[(const uint8_t *)b_10(D) + 1B];
if (_2 != 0)
- goto <bb 6>; [50.00%]
- else
goto <bb 5>; [50.00%]
+ else
+ goto <bb 6>; [50.00%]
- <bb 5> [local count: 536870913]:
+ <bb 5> [local count: 536870912]:
+ _19 = iftmp.3_7 | 4;
<bb 6> [local count: 1073741824]:
- # iftmp.4_8 = PHI <4(4), 0(5)>
- _3 = iftmp.3_7 | iftmp.4_8;
- _4 = _3 * 4;
+ # iftmp.4_8 = PHI <4(5), 0(4)>
+ # prephitmp_20 = PHI <_19(5), iftmp.3_7(4)>
+ _4 = prephitmp_20 * 4;
_5 = 4837447714461450240 >> _4;
_6 = (int) _5;
len_11 = _6 & 15;
in the get_length4 case this pattern doesn't occur since the branch has
been removed by early folding and/or gimplification already.
More information about the Gcc-bugs
mailing list