================
@@ -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
----------------
MaxGraey wrote:

> Not sure if InstCombine is the right place to perform the canonicalization

That was what worried me the most. It’s pretty hard to figure out where the 
best place is, given that the entry points for the canonicalizations are spread 
out in different places.

https://github.com/llvm/llvm-project/pull/191022
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to