[msan] Basic handling of inline asm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168884 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evgeniy Stepanov 2012-11-29 14:32:03 +00:00
parent 7f128ea00c
commit 6d988b423a

View File

@ -1065,10 +1065,19 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Instruction &I = *CS.getInstruction(); Instruction &I = *CS.getInstruction();
assert((CS.isCall() || CS.isInvoke()) && "Unknown type of CallSite"); assert((CS.isCall() || CS.isInvoke()) && "Unknown type of CallSite");
if (CS.isCall()) { 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 // Allow only tail calls with the same types, otherwise
// we may have a false positive: shadow for a non-void RetVal // we may have a false positive: shadow for a non-void RetVal
// will get propagated to a void RetVal. // will get propagated to a void RetVal.
CallInst *Call = cast<CallInst>(&I);
if (Call->isTailCall() && Call->getType() != Call->getParent()->getType()) if (Call->isTailCall() && Call->getType() != Call->getParent()->getType())
Call->setTailCall(false); Call->setTailCall(false);
if (isa<IntrinsicInst>(&I)) { if (isa<IntrinsicInst>(&I)) {