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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |needs-bisection
   Target Milestone|---                         |17.0
           Priority|P3                          |P1
   Last reconfirmed|                            |2026-11-20
      Known to work|                            |16.2.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, we if-convert the loop body to

<bb 3> [local count: 1040133704]:
# acc_16 = PHI <acc_12(7), acc_6(15)>
# i_18 = PHI <i_13(7), 0(15)>
# ivtmp_17 = PHI <ivtmp_3(7), 31(15)>
_1 = __builtin_ctz (c_8);
_14 = (short unsigned int) _1;
_2 = c_8 != 0;
prephitmp_15 = _2 ? _14 : 1;
acc_12 = prephitmp_15 | acc_16;
i_13 = i_18 + 1;
ivtmp_3 = ivtmp_17 - 1;
if (ivtmp_3 != 0)
  goto <bb 7>; [96.77%]
else
  goto <bb 6>; [3.23%]

ctz() and other functions possibly ivoking UB cannot be if-converted.  ctz()
can, but only now as we can honor .CTZ (.., <defined-value-at-zero>) where
ifcvt could insert the appropriate value.

Now, __builtin_ctzg (c, -1) could be lowered differently as we added support
for RTL expansion of arbitrary at-zero values.

Reply via email to