*cache = NULL;
}
-/* If VAL != CST * DIV for any constant CST, returns false.
- Otherwise, if *MULT_SET is true, additionally compares CST and MULT,
- and if they are different, returns false. Finally, if neither of these
- two cases occur, true is returned, and CST is stored to MULT and MULT_SET
- is set to true. */
+/* If VAL == CST * DIV for any constant CST, returns true.
+ and if *MULT_SET is true, additionally compares CST and MULT
+ and if they are different, returns false. If true is returned, CST is
+ stored to MULT and MULT_SET is set to true unless VAL and DIV are both zero
+ in which case neither MULT nor MULT_SET are updated. */
static bool
wide_int_constant_multiple_p (const poly_widest_int &val,
if (known_eq (val, 0))
{
+ if (known_eq (div, 0))
+ return true;
+
if (*mult_set && maybe_ne (*mult, 0))
return false;
*mult_set = true;