msan: Stop stripping the 'tail' modifier off of calls
authorReid Kleckner <reid@kleckner.net>
Mon, 30 Jun 2014 20:12:27 +0000 (20:12 +0000)
committerReid Kleckner <reid@kleckner.net>
Mon, 30 Jun 2014 20:12:27 +0000 (20:12 +0000)
This probably isn't necessary since msan started to unpoison the return
value shadow memory before all calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212061 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/MemorySanitizer.cpp
test/Instrumentation/MemorySanitizer/msan_basic.ll

index 4ca03238071f11a8fd330f99fe2edad9a3dd8439..b08a4773f95fcecaa0da80855094c170beef53a5 100644 (file)
@@ -2272,12 +2272,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
         return;
       }
 
-      // Allow only tail calls with the same types, otherwise
-      // we may have a false positive: shadow for a non-void RetVal
-      // will get propagated to a void RetVal.
-      if (Call->isTailCall() && Call->getType() != Call->getParent()->getType())
-        Call->setTailCall(false);
-
       assert(!isa<IntrinsicInst>(&I) && "intrinsics are handled elsewhere");
 
       // We are going to insert code that relies on the fact that the callee
index 6b71310c61d60373da08e84a2d1b7f5cde5fab95..3a1b6e023545e1b267750791638bd4d9c212fda3 100644 (file)
@@ -825,3 +825,17 @@ entry:
 ; CHECK: store i64 16, i64* @__msan_va_arg_overflow_size_tls
 ; CHECK: call void (i32, ...)* @VAArgStructFn
 ; CHECK: ret void
+
+declare i32 @InnerTailCall(i32 %a)
+
+define void @MismatchedReturnTypeTailCall(i32 %a) {
+  %b = tail call i32 @InnerTailCall(i32 %a)
+  ret void
+}
+
+; We used to strip off the 'tail' modifier, but now that we unpoison return slot
+; shadow before the call, we don't need to anymore.
+
+; CHECK-LABEL: define void @MismatchedReturnTypeTailCall
+; CHECK: tail call i32 @InnerTailCall
+; CHECK: ret void