[asan] Fix x86-32 asm instrumentation to preserve flags.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 21 May 2014 08:14:24 +0000 (08:14 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 21 May 2014 08:14:24 +0000 (08:14 +0000)
Patch by Yuri Gorshenin.

llvm-svn: 209280

llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp

index 85c7bf0..f3e6b3f 100644 (file)
@@ -161,8 +161,7 @@ void X86AddressSanitizer32::InstrumentMemOperandImpl(
         MCSymbolRefExpr::Create(FuncSym, MCSymbolRefExpr::VK_PLT, Ctx);
     EmitInstruction(Out, MCInstBuilder(X86::CALLpcrel32).addExpr(FuncExpr));
   }
-  EmitInstruction(Out, MCInstBuilder(X86::ADD32ri).addReg(X86::ESP)
-                           .addReg(X86::ESP).addImm(4));
+  EmitInstruction(Out, MCInstBuilder(X86::POP32r).addReg(X86::EAX));
   EmitInstruction(Out, MCInstBuilder(X86::POP32r).addReg(X86::EAX));
 }