[PATCH] msan: Handle musttail calls

Evgeniy Stepanov eugenis at google.com
Mon Jun 30 01:18:59 PDT 2014


LGTM w/ nits

================
Comment at: include/llvm/IR/Instructions.h:2418
@@ +2417,3 @@
+  /// return instruction with an optional bitcast instruction between them.
+  CallInst *getPrecedingMustTailCallIfPresent();
+
----------------
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.


================
Comment at: lib/Transforms/Instrumentation/MemorySanitizer.cpp:2280
@@ -2280,1 +2279,3 @@
+          Call->getType() != Call->getParent()->getType())
+        Call->setTailCallKind(CallInst::TCK_None);
 
----------------
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.

http://reviews.llvm.org/D4331






More information about the llvm-commits mailing list