[PATCH] D41043: Support for an intrinsic "fake.use" (and corresponding operand) representing a use of an operand to aid debugging

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 17:41:43 PST 2017


wolfgangp added inline comments.


================
Comment at: include/llvm/IR/Intrinsics.td:831
+// Introduce a use of the argument without generating any code.
+def int_fake_use : Intrinsic<[], [llvm_vararg_ty]>;
+
----------------
efriedma wrote:
> Does this support more than one argument?
Theoretically yes, but it wouldn't work at the moment (SelectionDAG would have to translate it into several FAKE_USE machine ops). Could be an improvement, but the code in the FE would have to be a little better about collecting several locals at the same lexical level.


================
Comment at: lib/Transforms/Utils/CloneFunction.cpp:333
+      if (IntrInst->getIntrinsicID() == Intrinsic::fake_use)
+        continue;
+
----------------
efriedma wrote:
> This is an interesting heuristic...
> 
> Putting the code here isn't great; IIRC some code outside the inliner uses this codepath.
Short inline member functions suffer when you can no longer optimize '*this', because 'this' is fake-used. Resulted in a fairly large performance degradation. 

Thanks for pointing this out. I'll check for other places cloning is used. One place I'm aware of is generating thunks for virtual varargs methods.


https://reviews.llvm.org/D41043





More information about the llvm-commits mailing list