Before, we only folded (x * 0) -> 0. It's possible that the 0 can show up on the RHS instead of the LHS. (E.g. inlining a memset and getting a multiply of two constants.)
So, let's fold 0 on the LHS as well.
Example: https://godbolt.org/z/CHQVs9
Differential D81876
[GlobalISel] Combine (0 * x) -> 0 paquette on Jun 15 2020, 1:48 PM. Authored by
Details Before, we only folded (x * 0) -> 0. It's possible that the 0 can show up on the RHS instead of the LHS. (E.g. inlining a memset and getting a multiply of two constants.) So, let's fold 0 on the LHS as well. Example: https://godbolt.org/z/CHQVs9
Diff Detail Event TimelineComment Actions LGTM but I think this is unnecessary since it was a simple fix to just avoid generating useless multiplies in fc905ae003df Feel free to commit anyway. Comment Actions I think I'd rather take the canonicalization route. I'll drop this so we can do this the right way. |