[Mlir-commits] [mlir] [mlir] Add `requiresAmendingMutatedDefs` and `amendMutatedDefs` to `PromotableOpInterface` (PR #86792)
Théo Degioanni
llvmlistbot at llvm.org
Thu Mar 28 12:39:22 PDT 2024
================
@@ -229,6 +229,36 @@ def PromotableOpInterface : OpInterface<"PromotableOpInterface"> {
(ins "const ::llvm::SmallPtrSetImpl<mlir::OpOperand *> &":$blockingUses,
"::mlir::RewriterBase &":$rewriter)
>,
+ InterfaceMethod<[{
+ This method returns whether the promoted operation requires amending the
+ mutated definitions by a store operation.
+
+ If this method returns true, the operation will be visited using the
+ `amendMutatedDefs` method after the main mutation stage finishes
+ (i.e., after all ops have been processed with `removeBlockingUses`).
+
+ Operations should only request amending the mutated definitions if the
+ intended transformation applies to all mutated values. Furthermore,
+ mutated values must not be deleted.
+ }], "bool", "requiresAmendingMutatedDefs", (ins), [{}],
+ [{ return false; }]
+ >,
+ InterfaceMethod<[{
+ Transforms the IR to amend all the mutated definitions to the slot by a
+ store operation.
+
+ This method will only be called after all blocking uses have been
+ scheduled for removal and if `requiresAmendingMutatedDefs` returned
+ true.
+
+ The rewriter is located after the promotable operation on call. All IR
+ mutations must happen through the rewriter. During the transformation,
+ *no operation should be deleted*.
+ }],
+ "void", "amendMutatedDefs",
+ (ins "::llvm::ArrayRef<std::pair<::mlir::Operation*, ::mlir::Value>>":$mutatedDefs,
+ "::mlir::RewriterBase &":$rewriter), [{}], [{ return; }]
----------------
Moxinilian wrote:
I feel like to be absolutely complete this method should also provide the memory slot, as one may want to know which memory slot specifically those definitions correspond to. But at the same time I am not really sure that this would be useful in practice, so change it only if you feel like it.
https://github.com/llvm/llvm-project/pull/86792
More information about the Mlir-commits
mailing list