https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87287
Bug ID: 87287 Summary: Move signed (x % pow2) == 0 optimization to gimple Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- As can be seen on: void f0 (void); int f1 (int x) { return x % 16 == 0; } int f2 (int x) { int y = x % 16; return y != 0; } void f3 (int x) { if (x % 16 != 0) f0 (); } void f4 (int x) { int y = x % 16; if (y == 0) f0 (); } we perform this optimization in fold-const.c only, it should be moved to match.pd.