summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorBetul Buyukkurt <betulb@codeaurora.org>2016-03-29 20:44:09 +0000
committerBetul Buyukkurt <betulb@codeaurora.org>2016-03-29 20:44:09 +0000
commitcb6f5f16e62c58626af55360fec40c963de34870 (patch)
tree561e1a15639012ac95906a7a6401d907b94e2270 /clang/lib
parente11e08bd1fca0948c36151d27780c3f3a40810a0 (diff)
downloadbcm5719-llvm-cb6f5f16e62c58626af55360fec40c963de34870.tar.gz
bcm5719-llvm-cb6f5f16e62c58626af55360fec40c963de34870.zip
[PGO] Move the instrumentation point closer to the value site.
For terminator instructions, the value profiling instrumentation happens in a basic block other than where the value site resides. This CR moves the instrumentation point prior to the value site. Mostly NFC. llvm-svn: 264783
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 5b8e3427136..e5993f51e4d 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -757,10 +757,10 @@ void CodeGenPGO::valueProfile(CGBuilderTy &Builder, uint32_t ValueKind,
bool InstrumentValueSites = CGM.getCodeGenOpts().hasProfileClangInstr();
if (InstrumentValueSites && RegionCounterMap) {
- llvm::LLVMContext &Ctx = CGM.getLLVMContext();
- auto *I8PtrTy = llvm::Type::getInt8PtrTy(Ctx);
+ auto BuilderInsertPoint = Builder.saveIP();
+ Builder.SetInsertPoint(ValueSite);
llvm::Value *Args[5] = {
- llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy),
+ llvm::ConstantExpr::getBitCast(FuncNameVar, Builder.getInt8PtrTy()),
Builder.getInt64(FunctionHash),
Builder.CreatePtrToInt(ValuePtr, Builder.getInt64Ty()),
Builder.getInt32(ValueKind),
@@ -768,6 +768,7 @@ void CodeGenPGO::valueProfile(CGBuilderTy &Builder, uint32_t ValueKind,
};
Builder.CreateCall(
CGM.getIntrinsic(llvm::Intrinsic::instrprof_value_profile), Args);
+ Builder.restoreIP(BuilderInsertPoint);
return;
}
OpenPOWER on IntegriCloud