[PATCH] msan: Handle musttail calls

Reid Kleckner rnk at google.com
Mon Jun 30 13:09:55 PDT 2014


================
Comment at: include/llvm/IR/Instructions.h:2418
@@ +2417,3 @@
+  /// return instruction with an optional bitcast instruction between them.
+  CallInst *getPrecedingMustTailCallIfPresent();
+
----------------
Evgeniy Stepanov wrote:
> Are you sure it should be part of ReturnInst interface?
> Makes more sense as a utility function to me.
> Anyway, this is an unrelated refactoring, please commit separately.
> 
I agree, the IR classes are generally very lightweight and don't have these kinds of analysis helpers.

+chandlerc, WDYT?  Is there a better place to put this?

================
Comment at: lib/Transforms/Instrumentation/MemorySanitizer.cpp:2280
@@ -2280,1 +2279,3 @@
+          Call->getType() != Call->getParent()->getType())
+        Call->setTailCallKind(CallInst::TCK_None);
 
----------------
Evgeniy Stepanov wrote:
> I no longer understand what is this code trying to achieve. The comment suggests that there is a problem when caller returns void, and that's exactly the case you are enabling for musttail calls.
> 
> But this whole thing does not make sense, and I can't figure out what is it that tail call optimization can break. Perhaps it had something to do with the hybrid tool and had been made obsolete by us resetting retval shadow to 0 _before_ every call.
> 
> Anyway, the tests still pass if this chunk is removed. I suggest you just do that. If I'm missing something, we will know it soon enough.
> 
OK.  :)  I'll commit that as a separate change without any of the actual musttail handling stuff.

http://reviews.llvm.org/D4331






More information about the llvm-commits mailing list