[PATCH] D18636: [PGO] Avoid instrumenting constants at value sites

Betul Buyukkurt via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 11:40:38 PDT 2016


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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18636.52249.patch
Type: text/x-patch
Size: 1045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160331/7ad46f7f/attachment.bin>


More information about the cfe-commits mailing list