https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115055
Bug ID: 115055 Summary: reassociation should use match-and-simplify Product: gcc Version: 15.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: ``` int f(int a, int c) { int b = a & c; return (a == 0) & b; } ``` This should be optimized to 0 but currently does not. There is a match pattern (via PR 111431) which is able to handle `a & (a == 0)` into `0`. reassociation knows how to handle `a & a` but it seems like if while doing reassociation, we should be to try to use match-and-simplify to simplify the f here.