public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109957] New: Missing loop PHI optimization
@ 2023-05-24 17:30 pinskia at gcc dot gnu.org
  2023-05-25  7:56 ` [Bug tree-optimization/109957] " rguenth at gcc dot gnu.org
  2023-06-07  2:43 ` cvs-commit at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-24 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109957
           Summary: Missing loop PHI optimization
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
void foo();
int main() {
  _Bool c = 0;
  _Bool e = 1;
  int i;
  for (i = 0; i < 10000; i++)
  {
    c |= (e!=0);
    e = 0;
  }
  if (c == 0)
    foo();
  return 0;
}
```

This should be just optimized to just `return 0`.
The reason is once c is 1, it will always stay 1.
But currently we don't notice that.

Note this code is reduced from PR 108352 testcase after a phiopt improvement
that provided the above form and ran into a testcase failure because of that.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-07  2:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 17:30 [Bug tree-optimization/109957] New: Missing loop PHI optimization pinskia at gcc dot gnu.org
2023-05-25  7:56 ` [Bug tree-optimization/109957] " rguenth at gcc dot gnu.org
2023-06-07  2:43 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).