https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120288
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2025-05-15
Keywords| |missed-optimization
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Comes from:
<bb 3> [local count: 114863530]:
_11 = &MEM[(const struct _Hashtable *)this_2(D)]._M_before_begin;
# VUSE <.MEM_1(D)>
_50 = MEM[(struct __node_base *)_11]._M_nxt;
if (_50 != 0B)
goto <bb 4>; [94.50%]
else
goto <bb 8>; [5.50%] ;; return
...
# _30 = PHI <_17(7), _11(3)> ;; _11 is non-null
# _31 = PHI <_18(7), _50(3)> ;; _50 is non-null
...
if (_30 != 0B)
goto <bb 5>; [74.64%]
else
goto <bb 6>; [25.36%]
<bb 5> [local count: 757361647]:
<bb 6> [local count: 1014686025]:
# _13 = PHI <0B(4), _31(5)>
# VUSE <.MEM_32>
_14 = MEM[(const struct key * const &)_13 + 8]; <--- here
...
<bb 7> [local count: 958878295]:
# VUSE <.MEM_47>
_17 = _30->_M_nxt;
# VUSE <.MEM_47>
_18 = MEM[(struct __node_base *)_17]._M_nxt;
if (_18 != 0B)
goto <bb 4>; [94.50%]
else
goto <bb 8>; [5.50%]
```
Looks like a missed optimization of non-nullness.