https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111487
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Thinking about how to handle binary operators. Here are some rules I came up with when we should prop the constant: * constants for the other operand (will reduce to a constant) * plus if it is used once (due to reduction of the constant) * specific constants for some binary operator: ** 0 for plus, mult and bit operators (bit_and, bit_ior and bit_xor) ** 1 for mult ** -1 for xor/ior and mult (~, constant and neg) ** min/max value for min/max (removes the min/max always) For non-communitive binary operators: * constants for other operand (always) * specific constants ** 0 for minus (either operand) and divide/mod (both operands) *** Note 0 for the second operand of divide/mod is `undefined` at that point ** 1 for divide (either operand); will reduce