aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-06-02 09:51:54 +0200
committerGitHub <noreply@github.com>2025-06-02 09:51:54 +0200
commite2b536431d85c49cdfad5106d116ced683a0667a (patch)
tree2bdba9709f113c45d9ff4d8f591a72013b81264e /clang/lib/CodeGen/CGDecl.cpp
parent9801fdf669bf6e61e276732a95c2f885cb2a39d9 (diff)
downloadllvm-e2b536431d85c49cdfad5106d116ced683a0667a.zip
llvm-e2b536431d85c49cdfad5106d116ced683a0667a.tar.gz
llvm-e2b536431d85c49cdfad5106d116ced683a0667a.tar.bz2
[CodeGen] Move CodeGenPGO behind unique_ptr (NFC) (#142155)
The InstrProf headers are very expensive. Avoid including them in all of CodeGen/ by moving the CodeGenPGO member behind a unqiue_ptr. This reduces clang build time by 0.8%.
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index f4549ab..e487a2b 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -18,6 +18,7 @@
#include "CGOpenMPRuntime.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
+#include "CodeGenPGO.h"
#include "ConstantEmitter.h"
#include "EHScopeStack.h"
#include "PatternInit.h"
@@ -368,7 +369,7 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const VarDecl &D,
return GV;
}
- PGO.markStmtMaybeUsed(D.getInit()); // FIXME: Too lazy
+ PGO->markStmtMaybeUsed(D.getInit()); // FIXME: Too lazy
#ifndef NDEBUG
CharUnits VarSize = CGM.getContext().getTypeSizeInChars(D.getType()) +
@@ -1944,7 +1945,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
// unless it contains a label.
if (!HaveInsertPoint()) {
if (!Init || !ContainsLabel(Init)) {
- PGO.markStmtMaybeUsed(Init);
+ PGO->markStmtMaybeUsed(Init);
return;
}
EnsureInsertPoint();
@@ -2057,7 +2058,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
return EmitExprAsInit(Init, &D, lv, capturedByInit);
}
- PGO.markStmtMaybeUsed(Init);
+ PGO->markStmtMaybeUsed(Init);
if (!emission.IsConstantAggregate) {
// For simple scalar/complex initialization, store the value directly.