This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Use explicit replace in canonicalization pattern (NFC).
ClosedPublic

Authored by gysit on Mar 10 2022, 3:37 AM.

Details

Summary

Introduce an explicit replaceOp call to enable the tracking of the producer LinalgOp.

Diff Detail

Event Timeline

gysit created this revision.Mar 10 2022, 3:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 3:37 AM
gysit requested review of this revision.Mar 10 2022, 3:37 AM
nicolasvasilache accepted this revision.Mar 11 2022, 1:42 AM

Thanks for fixing this!

This revision is now accepted and ready to land.Mar 11 2022, 1:42 AM
rriddle added inline comments.Mar 11 2022, 1:44 AM
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
1649

Why is the SmallVector necessary here? Can you not just do: rewriter.replaceOp(linalgOp, newOp->getResults())

gysit added inline comments.Mar 11 2022, 11:52 AM
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
1649

One of the replacement values needs to be set to castBack (see next line). The castBack value is needed if the result has more uses than just castOp.