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

Betul Buyukkurt via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 21:44:10 PDT 2016


betulb created this revision.
betulb added reviewers: davidxl, xur.
betulb added a subscriber: llvm-commits.
betulb set the repository for this revision to rL LLVM.
betulb changed the visibility of this Differential Revision from "Public (No Login Required)" to "All Users".

Direct callees' that are cast to other function prototypes,
show up in the Call/Invoke instructions as ConstantExpr's.
Currently llvm::CallSite's getCalledFunction() fails
to return the callees in such expressions as direct calls.
Value profiling should avoid instrumenting such cases. Mostly NFC.

Repository:
  rL LLVM

http://reviews.llvm.org/D18681

Files:
  lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Index: lib/Transforms/Instrumentation/PGOInstrumentation.cpp
===================================================================
--- lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -340,6 +340,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.52325.patch
Type: text/x-patch
Size: 425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160401/d29fa07e/attachment.bin>


More information about the llvm-commits mailing list