From 6d988b423acf37ed4d0b50b2678a18f65ab1a207 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Thu, 29 Nov 2012 14:32:03 +0000 Subject: [PATCH] [msan] Basic handling of inline asm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168884 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/MemorySanitizer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 46d22aacf95..d745a0c47af 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -1065,10 +1065,19 @@ struct MemorySanitizerVisitor : public InstVisitor { Instruction &I = *CS.getInstruction(); assert((CS.isCall() || CS.isInvoke()) && "Unknown type of CallSite"); if (CS.isCall()) { + CallInst *Call = cast(&I); + + // For inline asm, do the usual thing: check argument shadow and mark all + // outputs as clean. Note that any side effects of the inline asm that are + // not immediately visible in its constraints are not handled. + if (Call->isInlineAsm()) { + visitInstruction(I); + 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. - CallInst *Call = cast(&I); if (Call->isTailCall() && Call->getType() != Call->getParent()->getType()) Call->setTailCall(false); if (isa(&I)) {