[PATCH] D135797: [mlir][MemRef] Move the forwarding patterns for `extract_strided_metadata`

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 00:44:07 PST 2022


qcolombet added a subscriber: ftynse.
qcolombet added inline comments.


================
Comment at: mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:1328
+
+  bool atLeastOneReplacement = replaceConstantUsesOf(
+      builder, getLoc(), ArrayRef<TypedValue<IndexType>>(getOffset()),
----------------
Hardcode84 wrote:
> Here `replaceConstantUsesOf` creates new ops and replaces uses of op being folded. Is this even legal to do this from the folder? How it will interoperate with greedy rewriter which has no way to know new ops were created or uses were changed?
> 
> This should probably be an canonicalization pattern and not folder.
> Is this even legal to do this from the folder?

Good question, I didn't realize this was the first time such folding pattern was introduced.

@nicolasvasilache, @ftynse, @mehdi_amini  what do you think?

> How it will interoperate with greedy rewriter which has no way to know new ops were created or uses were changed?

IIRC that part was working just fine, but to be fair, I don't remember if I was testing more than just the lowering of `memref` (I think I was, but not sure).
If I am not mistaken the `::create` method will notify the listener that something has been added.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135797/new/

https://reviews.llvm.org/D135797



More information about the llvm-commits mailing list