https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100958
Bug ID: 100958 Summary: two_value_replacement should move to match.pd Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: pinskia at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- two_value_replacement can be fully implemented in match.pd now. So it should move. I did not do it originally but it. Comment from two_value_replacement : /* Optimize # x_5 in range [cst1, cst2] where cst2 = cst1 + 1 if (x_5 op cstN) # where op is == or != and N is 1 or 2 goto bb3; else goto bb4; bb3: bb4: # r_6 = PHI<cst3(2), cst4(3)> # where cst3 == cst4 + 1 or cst4 == cst3 + 1 to r_6 = x_5 + (min (cst3, cst4) - cst1) or r_6 = (min (cst3, cst4) + cst1) - x_5 depending on op, N and which of cst3 and cst4 is smaller. */