[PATCH] D76335: [mlir] Update DRR patterns to notify the rewriter why a pattern fails to match.
Jacques Pienaar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 17 18:56:20 PDT 2020
jpienaar accepted this revision.
jpienaar added a comment.
This revision is now accepted and ready to land.
Conciser than expected, thanks!
================
Comment at: mlir/tools/mlir-tblgen/RewriterGen.cpp:86
+ // Emits C++ for checking a match with a corresponding failure diagnostic.
+ void emitMatchCheck(int depth, const FmtObjectBase &matchFmt,
----------------
match failure?
================
Comment at: mlir/tools/mlir-tblgen/RewriterGen.cpp:394
+ const llvm::formatv_object_base &failureFmt) {
+ // {0} The match depth(used to get the operation that failed to match).
+ // {1} The format for the match string.
----------------
Missing space between h and (
================
Comment at: mlir/tools/mlir-tblgen/RewriterGen.cpp:420
+ emitMatchCheck(
+ /*depth=*/0, tgfmt(condition, &fmtCtx.withSelf(self.str())),
+ formatv("\"value entity '{0}' failed to satisfy constraint: {1}\"",
----------------
Could you extract depth=0 as variable and use it here and in line 409?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76335/new/
https://reviews.llvm.org/D76335
More information about the llvm-commits
mailing list