Don't leak the old operand when transforming "sldt" into "sldtw".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113200 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index e54edf2..1950c1d 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -837,8 +837,10 @@
// effect (both store to a 16-bit mem). Force to sldtw to avoid ambiguity
// errors, since its encoding is the most compact.
if (Name == "sldt" && Operands.size() == 2 &&
- static_cast<X86Operand*>(Operands[1])->isMem())
+ static_cast<X86Operand*>(Operands[1])->isMem()) {
+ delete Operands[0];
Operands[0] = X86Operand::CreateToken("sldtw", NameLoc);
+ }
return false;
}