https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102872
Bug ID: 102872 Summary: If statement is always false but not figured out at gimple level Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: missed-optimization, TREE 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(void); static int a, b; int main() { for (; a; ++a) { unsigned short d = a; if (!(b | d) && d) foo(); } } ---- CUT --- This is the reduced testcase of PR 102703 but without the store to a static variable which then was removed. In VRP1 we have: d_10 = (short unsigned int) a.3_5; _9 = a.3_5 & 65535; if (_9 == 0) goto <bb 4>; [50.00%] else goto <bb 6>; [50.00%] <bb 4> [local count: 477815112]: if (d_10 != 0) goto <bb 5>; [33.00%] else goto <bb 6>; [67.00%] <bb 5> [local count: 157678986]: foo (); _9 and d_10 have the same value though different types.