https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126904
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Component|middle-end |tree-optimization
CC| |pinskia at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Last reconfirmed| |2026-08-16
Ever confirmed|0 |1
--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Take:
```
void foo (void);
static void __attribute__((noinline))
spin (int n)
{
while (n)
;
}
int t ;
double t1;
void
f (int *p, int k)
{
t = 1;
if (*p == k)
;
else
t = 2;
#ifndef OK
spin (k);
#endif
if (*p != k)
foo ();
}
```
PRE is able to handle it when OK is defined.
I think DOM skips over calls that don't have VDEF while VN only does that for
functions which are marked as const or pure (if I am reading the code
correctly).