[PATCH] D18681: [PGO] Avoid instrumenting direct callee's at value sites.

Betul Buyukkurt via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 21:59:27 PDT 2016


betulb updated this revision to Diff 52456.
betulb added a comment.

Added a test case.


Repository:
  rL LLVM

http://reviews.llvm.org/D18681

Files:
  lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h
  test/Transforms/PGOProfile/do-not-instrument.ll

Index: test/Transforms/PGOProfile/do-not-instrument.ll
===================================================================
--- test/Transforms/PGOProfile/do-not-instrument.ll
+++ test/Transforms/PGOProfile/do-not-instrument.ll
@@ -14,4 +14,14 @@
   ret i32 0
 }
 
+define i32 @f2() {
+entry:
+; CHECK: call void @llvm.instrprof.increment
+; CHECK-NOT: call void @llvm.instrprof.value.profile
+  call void (i32, ...) bitcast (void (...)* @foo to void (i32, ...)*)(i32 21)
+  ret i32 0
+}
+
+declare void @foo(...) #0
+
 attributes #0 = { nounwind }
Index: lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h
===================================================================
--- lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h
+++ lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h
@@ -28,6 +28,8 @@
       if (CI->isInlineAsm())
         return;
     }
+    if (isa<Constant>(CS.getCalledValue()))
+      return;
     IndirectCallInsts.push_back(I);
   }
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18681.52456.patch
Type: text/x-patch
Size: 980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160402/43682fe1/attachment.bin>


More information about the llvm-commits mailing list