diff options
author | Nikita Popov <npopov@redhat.com> | 2025-06-02 09:51:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-02 09:51:54 +0200 |
commit | e2b536431d85c49cdfad5106d116ced683a0667a (patch) | |
tree | 2bdba9709f113c45d9ff4d8f591a72013b81264e /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 9801fdf669bf6e61e276732a95c2f885cb2a39d9 (diff) | |
download | llvm-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/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 4193f0a..0388c67 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -80,7 +80,8 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext) Builder(cgm, cgm.getModule().getContext(), llvm::ConstantFolder(), CGBuilderInserterTy(this)), SanOpts(CGM.getLangOpts().Sanitize), CurFPFeatures(CGM.getLangOpts()), - DebugInfo(CGM.getModuleDebugInfo()), PGO(cgm), + DebugInfo(CGM.getModuleDebugInfo()), + PGO(std::make_unique<CodeGenPGO>(cgm)), ShouldEmitLifetimeMarkers( shouldEmitLifetimeMarkers(CGM.getCodeGenOpts(), CGM.getLangOpts())) { if (!suppressNewContext) @@ -1564,7 +1565,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, CurFn->addFnAttr(llvm::Attribute::MustProgress); // Generate the body of the function. - PGO.assignRegionCounters(GD, CurFn); + PGO->assignRegionCounters(GD, CurFn); if (isa<CXXDestructorDecl>(FD)) EmitDestructorBody(Args); else if (isa<CXXConstructorDecl>(FD)) @@ -1650,7 +1651,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, // Emit the standard function epilogue. FinishFunction(BodyRange.getEnd()); - PGO.verifyCounterMap(); + PGO->verifyCounterMap(); // If we haven't marked the function nothrow through other means, do // a quick pass now to see if we can. @@ -1774,7 +1775,7 @@ bool CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond, if (!AllowLabels && CodeGenFunction::ContainsLabel(Cond)) return false; // Contains a label. - PGO.markStmtMaybeUsed(Cond); + PGO->markStmtMaybeUsed(Cond); ResultInt = Int; return true; } @@ -3355,4 +3356,4 @@ void CodeGenFunction::addInstToNewSourceAtom(llvm::Instruction *KeyInstruction, ApplyAtomGroup Grp(getDebugInfo()); DI->addInstToCurrentSourceAtom(KeyInstruction, Backup); } -}
\ No newline at end of file +} |