From 3b15c970abf09ab7db383cd3512674f6db85e46d Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Mon, 30 Jun 2014 20:12:27 +0000 Subject: [PATCH] msan: Stop stripping the 'tail' modifier off of calls 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 | 6 ------ test/Instrumentation/MemorySanitizer/msan_basic.ll | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 4ca03238071..b08a4773f95 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -2272,12 +2272,6 @@ struct MemorySanitizerVisitor : public InstVisitor { 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(&I) && "intrinsics are handled elsewhere"); // We are going to insert code that relies on the fact that the callee diff --git a/test/Instrumentation/MemorySanitizer/msan_basic.ll b/test/Instrumentation/MemorySanitizer/msan_basic.ll index 6b71310c61d..3a1b6e02354 100644 --- a/test/Instrumentation/MemorySanitizer/msan_basic.ll +++ b/test/Instrumentation/MemorySanitizer/msan_basic.ll @@ -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 -- 2.34.1