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.