[msan] Basic handling of inline asm.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 29 Nov 2012 14:32:03 +0000 (14:32 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 29 Nov 2012 14:32:03 +0000 (14:32 +0000)
llvm-svn: 168884

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

index 46d22aa..d745a0c 100644 (file)
@@ -1065,10 +1065,19 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
     Instruction &I = *CS.getInstruction();
     assert((CS.isCall() || CS.isInvoke()) && "Unknown type of CallSite");
     if (CS.isCall()) {
+      CallInst *Call = cast<CallInst>(&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<CallInst>(&I);
       if (Call->isTailCall() && Call->getType() != Call->getParent()->getType())
         Call->setTailCall(false);
       if (isa<IntrinsicInst>(&I)) {