[llvm] ed1aabe - remove expensive copy of options passed (#82577)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 22:39:13 PST 2024
Author: mahesh-attarde
Date: 2024-02-27T14:39:09+08:00
New Revision: ed1aabef1da1b074b71ad523978ea836d6e7d2e7
URL: https://github.com/llvm/llvm-project/commit/ed1aabef1da1b074b71ad523978ea836d6e7d2e7
DIFF: https://github.com/llvm/llvm-project/commit/ed1aabef1da1b074b71ad523978ea836d6e7d2e7.diff
LOG: remove expensive copy of options passed (#82577)
Codegen option is passed copy by value which 138 bytes of copy and used
as read-only. Making pass by const reference.
Added:
Modified:
llvm/include/llvm/Passes/CodeGenPassBuilder.h
llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index 82a17e882b3c47..00eb9b096a9356 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -111,7 +111,8 @@ namespace llvm {
/// construction.
template <typename DerivedT> class CodeGenPassBuilder {
public:
- explicit CodeGenPassBuilder(LLVMTargetMachine &TM, CGPassBuilderOption Opts,
+ explicit CodeGenPassBuilder(LLVMTargetMachine &TM,
+ const CGPassBuilderOption &Opts,
PassInstrumentationCallbacks *PIC)
: TM(TM), Opt(Opts), PIC(PIC) {
// Target could set CGPassBuilderOption::MISchedPostRA to true to achieve
diff --git a/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp b/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
index a620ba911ec616..6ef28b373cc931 100644
--- a/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
+++ b/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
@@ -22,7 +22,7 @@ namespace {
class X86CodeGenPassBuilder : public CodeGenPassBuilder<X86CodeGenPassBuilder> {
public:
explicit X86CodeGenPassBuilder(LLVMTargetMachine &TM,
- CGPassBuilderOption Opts,
+ const CGPassBuilderOption &Opts,
PassInstrumentationCallbacks *PIC)
: CodeGenPassBuilder(TM, Opts, PIC) {}
void addPreISel(AddIRPass &addPass) const;
More information about the llvm-commits
mailing list