summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2014-03-06 04:55:35 +0000
committerBob Wilson <bob.wilson@apple.com>2014-03-06 04:55:35 +0000
commit83717113c57b1f9f7be295b007d60b44ac13f404 (patch)
treef782a951a92ac08de6b27d80d6ebaf07da050850 /lib/CodeGen/CodeGenFunction.cpp
parent4b1cb4e3c05e23d84a02c2120d1a5467e6d3e0eb (diff)
downloadclang-83717113c57b1f9f7be295b007d60b44ac13f404.tar.gz
clang-83717113c57b1f9f7be295b007d60b44ac13f404.tar.bz2
clang-83717113c57b1f9f7be295b007d60b44ac13f404.tar.xz
Refactor PGO code in preparation for handling non-C/C++ code.
Move the PGO.assignRegionCounters() call out of StartFunction, because that function is called from many places where it does not make sense to do PGO instrumentation (e.g., compiler-generated helper functions). Change several functions to take a StringRef argument for the unique name associated with a function, so that the name can be set differently for things like Objective-C methods and block literals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index c550aaded7..d0f1cb6b25 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -589,7 +589,6 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
if (CGM.getCodeGenOpts().InstrumentForProfiling)
EmitMCountInstrumentation();
- PGO.assignRegionCounters(GD);
if (CGM.getPGOData() && D) {
// Turn on InlineHint attribute for hot functions.
if (CGM.getPGOData()->isHotFunction(CGM.getMangledName(GD)))
@@ -771,6 +770,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));
if (isa<CXXDestructorDecl>(FD))
EmitDestructorBody(Args);
else if (isa<CXXConstructorDecl>(FD))
@@ -831,7 +831,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
if (!CurFn->doesNotThrow())
TryMarkNoThrow(CurFn);
- PGO.emitWriteoutFunction(CurGD);
+ PGO.emitWriteoutFunction(CGM.getMangledName(CurGD));
PGO.destroyRegionCounters();
}