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

Betul Buyukkurt via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 00:09:44 PDT 2016


betulb added inline comments.

================
Comment at: lib/CodeGen/CodeGenPGO.cpp:758
@@ -757,1 +757,3 @@
 
+  if (dyn_cast<llvm::Constant>(ValuePtr))
+    return;
----------------
davidxl wrote:
> Is it the bitcast guaranteed to be already stripped here?
No. ConstantExpr is derived from the Constant class. A ConstantExpr can only have other constants i.e. all immutable values as its operands. 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, thus they are instrumented in both clang FE and I believe in the IR based instrumentation as well . Instrumenting such calls is a waste of counters,  runtime calls and dynamic memory at run time.



Repository:
  rL LLVM

http://reviews.llvm.org/D18636





More information about the cfe-commits mailing list