Skip to content

Commit ed1aabe

Browse files
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.
1 parent 0ed61db commit ed1aabe

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm/include/llvm/Passes/CodeGenPassBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ namespace llvm {
111111
/// construction.
112112
template <typename DerivedT> class CodeGenPassBuilder {
113113
public:
114-
explicit CodeGenPassBuilder(LLVMTargetMachine &TM, CGPassBuilderOption Opts,
114+
explicit CodeGenPassBuilder(LLVMTargetMachine &TM,
115+
const CGPassBuilderOption &Opts,
115116
PassInstrumentationCallbacks *PIC)
116117
: TM(TM), Opt(Opts), PIC(PIC) {
117118
// Target could set CGPassBuilderOption::MISchedPostRA to true to achieve

llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace {
2222
class X86CodeGenPassBuilder : public CodeGenPassBuilder<X86CodeGenPassBuilder> {
2323
public:
2424
explicit X86CodeGenPassBuilder(LLVMTargetMachine &TM,
25-
CGPassBuilderOption Opts,
25+
const CGPassBuilderOption &Opts,
2626
PassInstrumentationCallbacks *PIC)
2727
: CodeGenPassBuilder(TM, Opts, PIC) {}
2828
void addPreISel(AddIRPass &addPass) const;

0 commit comments

Comments
 (0)