aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Rewrite/ByteCode.cpp
diff options
context:
space:
mode:
authorChris Lattner <clattner@nondot.org>2021-08-29 14:22:24 -0700
committerChris Lattner <clattner@nondot.org>2021-08-29 21:54:47 -0700
commit41d4aa7de68ed551010f27ff04ffc54e7616292a (patch)
treeea4357d5c6526ce161fbfe8be6ec6189c3193c1b /mlir/lib/Rewrite/ByteCode.cpp
parent3383ec5fdd04be095678e0bd8bd1ce341f4f9294 (diff)
downloadllvm-41d4aa7de68ed551010f27ff04ffc54e7616292a.zip
llvm-41d4aa7de68ed551010f27ff04ffc54e7616292a.tar.gz
llvm-41d4aa7de68ed551010f27ff04ffc54e7616292a.tar.bz2
[SymbolRefAttr] Revise SymbolRefAttr to hold a StringAttr.
SymbolRefAttr is fundamentally a base string plus a sequence of nested references. Instead of storing the string data as a copies StringRef, store it as an already-uniqued StringAttr. This makes a lot of things simpler and more efficient because: 1) references to the symbol are already stored as StringAttr's: there is no need to copy the string data into MLIRContext multiple times. 2) This allows pointer comparisons instead of string comparisons (or redundant uniquing) within SymbolTable.cpp. 3) This allows SymbolTable to hold a DenseMap instead of a StringMap (which again copies the string data and slows lookup). This is a moderately invasive patch, so I kept a lot of compatibility APIs around. It would be nice to explore changing getName() to return a StringAttr for example (right now you have to use getNameAttr()), and eliminate things like the StringRef version of getSymbol. Differential Revision: https://reviews.llvm.org/D108899
Diffstat (limited to 'mlir/lib/Rewrite/ByteCode.cpp')
-rw-r--r--mlir/lib/Rewrite/ByteCode.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp
index a81387f..4370b23 100644
--- a/mlir/lib/Rewrite/ByteCode.cpp
+++ b/mlir/lib/Rewrite/ByteCode.cpp
@@ -818,7 +818,7 @@ void Generator::generate(pdl_interp::IsNotNullOp op, ByteCodeWriter &writer) {
void Generator::generate(pdl_interp::RecordMatchOp op, ByteCodeWriter &writer) {
ByteCodeField patternIndex = patterns.size();
patterns.emplace_back(PDLByteCodePattern::create(
- op, rewriterToAddr[op.rewriter().getLeafReference()]));
+ op, rewriterToAddr[op.rewriter().getLeafReference().getValue()]));
writer.append(OpCode::RecordMatch, patternIndex,
SuccessorRange(op.getOperation()), op.matchedOps());
writer.appendPDLValueList(op.inputs());