[Mlir-commits] [mlir] [MLIR] Add canonicalizations to all eligible `index` binary ops (PR #114000)
weiwei chen
llvmlistbot at llvm.org
Tue Oct 29 08:38:03 PDT 2024
================
@@ -118,6 +118,31 @@ static OpFoldResult foldBinaryOpChecked(
return IntegerAttr::get(IndexType::get(lhs.getContext()), *result64);
}
+/// Helper for associative and commutative binary ops that can be transformed:
+/// `x = op(v, c1); y = op(x, c2)` -> `tmp = op(c1, c2); y = op(v, tmp)`
+/// where c1 and c2 are constants. It is expected that `tmp` will be folded.
+template <typename BinaryOp>
+static LogicalResult
----------------
weiweichen wrote:
You probably don't need `static` here because this is a template inside of a `.cpp` file.
https://github.com/llvm/llvm-project/pull/114000
More information about the Mlir-commits
mailing list