[Mlir-commits] [mlir] [mlir] Speed up FuncToLLVM: CallOpLowering using SymbolTableCollection (PR #68082)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 3 02:14:52 PDT 2023
https://github.com/tdanyluk created https://github.com/llvm/llvm-project/pull/68082
We have a project where this saves 23% of the compilation time.
This means using hashmaps instead of searching in linked lists.
>From 0181f18894f1e56b6fbf402b6a5a430ee571f69c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tam=C3=A1s=20Danyluk?= <tdanyluk at google.com>
Date: Tue, 3 Oct 2023 11:07:20 +0200
Subject: [PATCH] [mlir] Speed up FuncToLLVM: CallOpLowering using
SymbolTableCollection
We have a project where this saves 23% of the compilation time.
This means using hashmaps instead of searching in linked lists.
---
mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
index 7de7f3cb9e36b06..b853181c618365d 100644
--- a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
+++ b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
@@ -601,19 +601,23 @@ struct CallOpInterfaceLowering : public ConvertOpToLLVMPattern<CallOpType> {
}
};
-struct CallOpLowering : public CallOpInterfaceLowering<func::CallOp> {
+class CallOpLowering : public CallOpInterfaceLowering<func::CallOp> {
+public:
using Super::Super;
LogicalResult
matchAndRewrite(func::CallOp callOp, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
bool useBarePtrCallConv = false;
- if (Operation *callee = SymbolTable::lookupNearestSymbolFrom(
+ if (Operation *callee = symbolTableCollection.lookupNearestSymbolFrom(
callOp, callOp.getCalleeAttr())) {
useBarePtrCallConv = shouldUseBarePtrCallConv(callee, getTypeConverter());
}
return matchAndRewriteImpl(callOp, adaptor, rewriter, useBarePtrCallConv);
}
+
+private:
+ mutable SymbolTableCollection symbolTableCollection;
};
struct CallIndirectOpLowering
More information about the Mlir-commits
mailing list