[PATCH] D77521: Skip the op replacement if the returned results are empty
Feng Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 5 22:25:12 PDT 2020
liufengdb created this revision.
liufengdb added a reviewer: antiagainst.
Herald added subscribers: llvm-commits, grosul1, Joonsoo, lucyrfox, mgester, arpith-jacob, nicolasvasilache, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77521
Files:
mlir/tools/mlir-tblgen/RewriterGen.cpp
Index: mlir/tools/mlir-tblgen/RewriterGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -623,7 +623,9 @@
"\n");
}
os.indent(4) << "\n";
- os.indent(4) << "rewriter.replaceOp(op0, tblgen_repl_values);\n";
+ // Skip the op replacement if the result pattern doesn't return results.
+ os.indent(4) << "if (tblgen_repl_values.empty())\n";
+ os.indent(4) << " rewriter.replaceOp(op0, tblgen_repl_values);\n";
}
LLVM_DEBUG(llvm::dbgs() << "--- done emitting rewrite logic ---\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77521.255220.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/754bd3f5/attachment.bin>
More information about the llvm-commits
mailing list