summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2014-03-06 04:55:41 +0000
committerBob Wilson <bob.wilson@apple.com>2014-03-06 04:55:41 +0000
commite9773c0187bdd21fcdd4442025b8feb1ec03a345 (patch)
treeeb685654523b5baeeff064a2645bc9eb41141afe /lib/CodeGen/CodeGenFunction.cpp
parent467db6f5992514a4db2c9980407f22c394a36c57 (diff)
downloadclang-e9773c0187bdd21fcdd4442025b8feb1ec03a345.tar.gz
clang-e9773c0187bdd21fcdd4442025b8feb1ec03a345.tar.bz2
clang-e9773c0187bdd21fcdd4442025b8feb1ec03a345.tar.xz
PGO: Use the main file name to help distinguish functions with local linkage.
In addition, for all functions, use the name from the llvm::Function to identify the function in the profile data. Compute that "function name", including the file name for local functions, once when assigning the PGO counters and store it in the CodeGenPGO class. Move the code to add InlineHint and Cold attributes out of StartFunction(), because the "function name" string isn't available at that point. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index d0f1cb6b25..975ae6cb46 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -589,15 +589,6 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
if (CGM.getCodeGenOpts().InstrumentForProfiling)
EmitMCountInstrumentation();
- if (CGM.getPGOData() && D) {
- // Turn on InlineHint attribute for hot functions.
- if (CGM.getPGOData()->isHotFunction(CGM.getMangledName(GD)))
- Fn->addFnAttr(llvm::Attribute::InlineHint);
- // Turn on Cold attribute for cold functions.
- else if (CGM.getPGOData()->isColdFunction(CGM.getMangledName(GD)))
- Fn->addFnAttr(llvm::Attribute::Cold);
- }
-
if (RetTy->isVoidType()) {
// Void type; nothing to return.
ReturnValue = 0;
@@ -770,7 +761,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
StartFunction(GD, ResTy, Fn, FnInfo, Args, BodyRange.getBegin());
// Generate the body of the function.
- PGO.assignRegionCounters(GD.getDecl(), CGM.getMangledName(GD));
+ PGO.assignRegionCounters(GD.getDecl(), CurFn);
if (isa<CXXDestructorDecl>(FD))
EmitDestructorBody(Args);
else if (isa<CXXConstructorDecl>(FD))
@@ -831,7 +822,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
if (!CurFn->doesNotThrow())
TryMarkNoThrow(CurFn);
- PGO.emitWriteoutFunction(CGM.getMangledName(CurGD));
+ PGO.emitWriteoutFunction();
PGO.destroyRegionCounters();
}