[Bug tree-optimization/96187] GCC at -O2 generates branch for code that should be branch-free

2020-07-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96187

Richard Biener  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  ---
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 ; [50.00%]
-  else
 goto ; [50.00%]
+  else
+goto ; [50.00%]

-   [local count: 536870913]:
+   [local count: 536870912]:
+  _19 = iftmp.3_7 | 4;

[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.

[Bug tree-optimization/96187] GCC at -O2 generates branch for code that should be branch-free

2023-06-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96187

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |11.0
 Resolution|--- |FIXED
  Known to work||11.1.0
 Status|NEW |RESOLVED

--- Comment #2 from Andrew Pinski  ---
Fixed in GCC 11+ by r11-4717-g3e190757fa332d327be .

[Bug tree-optimization/96187] GCC at -O2 generates branch for code that should be branch-free

2021-05-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96187

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement