[Mlir-commits] [mlir] [MLIR] Add folding constants canonicalization for mlir::index::AddOp. (PR #111084)
Jeff Niu
llvmlistbot at llvm.org
Tue Oct 8 02:29:04 PDT 2024
================
@@ -136,6 +136,45 @@ OpFoldResult AddOp::fold(FoldAdaptor adaptor) {
return {};
}
+/// Canonicalize
+/// ` x = v + c1; y = x + c2` to `x = v + (c1 + c2)`
----------------
Mogball wrote:
This is the only permutation of the pattern that you actually need to implement. The canonicalizer will make sure that constants for commutative ops are always on the RHS.
https://github.com/llvm/llvm-project/pull/111084
More information about the Mlir-commits
mailing list