diff options
author | Bob Wilson <bob.wilson@apple.com> | 2014-03-06 04:55:35 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2014-03-06 04:55:35 +0000 |
commit | 68f475faf747c537591aa8a29bd9cdaf12da820b (patch) | |
tree | debdf32c8bad742bf989c0588f30b9c2b262b1d8 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 749ebc7f33de3ea3f3212daa3bdcd958b1ca0ff6 (diff) | |
download | llvm-68f475faf747c537591aa8a29bd9cdaf12da820b.zip llvm-68f475faf747c537591aa8a29bd9cdaf12da820b.tar.gz llvm-68f475faf747c537591aa8a29bd9cdaf12da820b.tar.bz2 |
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.
llvm-svn: 203073
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index c550aad..d0f1cb6 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/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(); } |