betulb removed rL LLVM as the repository for this revision. betulb updated this revision to Diff 52249. betulb added a comment.
Addressed review comments. http://reviews.llvm.org/D18636 Files: lib/CodeGen/CodeGenPGO.cpp test/Profile/c-avoid-direct-call.c Index: test/Profile/c-avoid-direct-call.c =================================================================== --- /dev/null +++ test/Profile/c-avoid-direct-call.c @@ -0,0 +1,11 @@ +// Check the value profiling instrinsics emitted by instrumentation. + +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-avoid-direct-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s + +void foo(); + +int main(void) { +// CHECK-NOT: call void @__llvm_profile_instrument_target + foo(21); + return 0; +} Index: lib/CodeGen/CodeGenPGO.cpp =================================================================== --- lib/CodeGen/CodeGenPGO.cpp +++ lib/CodeGen/CodeGenPGO.cpp @@ -755,6 +755,9 @@ if (!ValuePtr || !ValueSite || !Builder.GetInsertBlock()) return; + if (isa<llvm::Constant>(ValuePtr)) + return; + bool InstrumentValueSites = CGM.getCodeGenOpts().hasProfileClangInstr(); if (InstrumentValueSites && RegionCounterMap) { auto BuilderInsertPoint = Builder.saveIP();
Index: test/Profile/c-avoid-direct-call.c =================================================================== --- /dev/null +++ test/Profile/c-avoid-direct-call.c @@ -0,0 +1,11 @@ +// Check the value profiling instrinsics emitted by instrumentation. + +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-avoid-direct-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s + +void foo(); + +int main(void) { +// CHECK-NOT: call void @__llvm_profile_instrument_target + foo(21); + return 0; +} Index: lib/CodeGen/CodeGenPGO.cpp =================================================================== --- lib/CodeGen/CodeGenPGO.cpp +++ lib/CodeGen/CodeGenPGO.cpp @@ -755,6 +755,9 @@ if (!ValuePtr || !ValueSite || !Builder.GetInsertBlock()) return; + if (isa<llvm::Constant>(ValuePtr)) + return; + bool InstrumentValueSites = CGM.getCodeGenOpts().hasProfileClangInstr(); if (InstrumentValueSites && RegionCounterMap) { auto BuilderInsertPoint = Builder.saveIP();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits