================
@@ -1523,6 +1523,34 @@ static Instruction *foldBoxMultiply(BinaryOperator &I) {
return nullptr;
}
+/// Canonicalize a nested add/sub with a constant on the inner RHS by
+/// sinking the constant to the outer RHS.
+/// (X +/- C) +/- Y -> (X +/- Y) +/- C
----------------
nikic wrote:
LICM should undo this if profitable, see hoistSubAddAssociation() etc.
I'm more concerned that this is reassociating in the reverse direction of the
Reassociate pass, which will push constants towards the root, rather than the
leaves.
https://github.com/llvm/llvm-project/pull/191022
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits