[Bug tree-optimization/126904] backward threader: no path-sensitive load CSE (value numbering?)

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.