Index: lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp =================================================================== --- lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp +++ lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp @@ -223,6 +223,8 @@ uint32_t Insn = (Bytes[3] << 24) | (Bytes[2] << 16) | (Bytes[1] << 8) | (Bytes[0] << 0); + MI.clear(); + // Calling the auto-generated decoder function. return decodeInstruction(DecoderTable32, MI, Insn, Address, this, STI); } Index: lib/Target/ARM/Disassembler/ARMDisassembler.cpp =================================================================== --- lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ lib/Target/ARM/Disassembler/ARMDisassembler.cpp @@ -450,6 +450,7 @@ (Bytes[3] << 24) | (Bytes[2] << 16) | (Bytes[1] << 8) | (Bytes[0] << 0); // Calling the auto-generated decoder function. + MI.clear(); DecodeStatus Result = decodeInstruction(DecoderTableARM32, MI, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { @@ -710,6 +711,7 @@ } uint16_t Insn16 = (Bytes[1] << 8) | Bytes[0]; + MI.clear(); DecodeStatus Result = decodeInstruction(DecoderTableThumb16, MI, Insn16, Address, this, STI); if (Result != MCDisassembler::Fail) { Index: lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp =================================================================== --- lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp +++ lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp @@ -234,6 +234,8 @@ bool Complete = false; Size = 0; + MI.clear(); + *CurrentBundle = &MI; MI.setOpcode(Hexagon::BUNDLE); MI.addOperand(MCOperand::createImm(0)); Index: lib/Target/Mips/Disassembler/MipsDisassembler.cpp =================================================================== --- lib/Target/Mips/Disassembler/MipsDisassembler.cpp +++ lib/Target/Mips/Disassembler/MipsDisassembler.cpp @@ -833,6 +833,7 @@ DEBUG(dbgs() << "Trying MicroMips16 table (16-bit instructions):\n"); // Calling the auto-generated decoder function. + Instr.clear(); Result = decodeInstruction(DecoderTableMicroMips16, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { @@ -847,11 +848,13 @@ if (hasMips32r6()) { DEBUG(dbgs() << "Trying MicroMips32r632 table (32-bit instructions):\n"); // Calling the auto-generated decoder function. + Instr.clear(); Result = decodeInstruction(DecoderTableMicroMips32r632, Instr, Insn, Address, this, STI); } else { DEBUG(dbgs() << "Trying MicroMips32 table (32-bit instructions):\n"); // Calling the auto-generated decoder function. + Instr.clear(); Result = decodeInstruction(DecoderTableMicroMips32, Instr, Insn, Address, this, STI); } @@ -868,6 +871,7 @@ if (hasCOP3()) { DEBUG(dbgs() << "Trying COP3_ table (32-bit opcodes):\n"); + Instr.clear(); Result = decodeInstruction(DecoderTableCOP3_32, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { @@ -878,6 +882,7 @@ if (hasMips32r6() && isGP64()) { DEBUG(dbgs() << "Trying Mips32r6_64r6 (GPR64) table (32-bit opcodes):\n"); + Instr.clear(); Result = decodeInstruction(DecoderTableMips32r6_64r6_GP6432, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { @@ -888,6 +893,7 @@ if (hasMips32r6()) { DEBUG(dbgs() << "Trying Mips32r6_64r6 table (32-bit opcodes):\n"); + Instr.clear(); Result = decodeInstruction(DecoderTableMips32r6_64r632, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { @@ -898,6 +904,7 @@ if (hasCnMips()) { DEBUG(dbgs() << "Trying CnMips table (32-bit opcodes):\n"); + Instr.clear(); Result = decodeInstruction(DecoderTableCnMips32, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { @@ -908,6 +915,7 @@ if (isGP64()) { DEBUG(dbgs() << "Trying Mips64 (GPR64) table (32-bit opcodes):\n"); + Instr.clear(); Result = decodeInstruction(DecoderTableMips6432, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { @@ -918,6 +926,7 @@ DEBUG(dbgs() << "Trying Mips table (32-bit opcodes):\n"); // Calling the auto-generated decoder function. + Instr.clear(); Result = decodeInstruction(DecoderTableMips32, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) { Index: lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp =================================================================== --- lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp +++ lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp @@ -397,14 +397,14 @@ : support::endian::read32be(Bytes.data()); if (STI.getFeatureBits()[PPC::FeatureQPX]) { + MI.clear(); DecodeStatus result = decodeInstruction(DecoderTableQPX32, MI, Inst, Address, this, STI); if (result != MCDisassembler::Fail) return result; - - MI.clear(); } + MI.clear(); return decodeInstruction(DecoderTable32, MI, Inst, Address, this, STI); } Index: lib/Target/Sparc/Disassembler/SparcDisassembler.cpp =================================================================== --- lib/Target/Sparc/Disassembler/SparcDisassembler.cpp +++ lib/Target/Sparc/Disassembler/SparcDisassembler.cpp @@ -257,6 +257,8 @@ if (Result == MCDisassembler::Fail) return MCDisassembler::Fail; + Instr.clear(); + // Calling the auto-generated decoder function. Result = decodeInstruction(DecoderTableSparc32, Instr, Insn, Address, this, STI); Index: lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp =================================================================== --- lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp +++ lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp @@ -375,5 +375,7 @@ for (uint64_t I = 0; I < Size; ++I) Inst = (Inst << 8) | Bytes[I]; + MI.clear(); + return decodeInstruction(Table, MI, Inst, Address, this, STI); } Index: lib/Target/X86/Disassembler/X86Disassembler.cpp =================================================================== --- lib/Target/X86/Disassembler/X86Disassembler.cpp +++ lib/Target/X86/Disassembler/X86Disassembler.cpp @@ -157,6 +157,7 @@ return Fail; } else { Size = InternalInstr.length; + Instr.clear(); return (!translateInstruction(Instr, InternalInstr, this)) ? Success : Fail; } } Index: lib/Target/XCore/Disassembler/XCoreDisassembler.cpp =================================================================== --- lib/Target/XCore/Disassembler/XCoreDisassembler.cpp +++ lib/Target/XCore/Disassembler/XCoreDisassembler.cpp @@ -745,6 +745,7 @@ } // Calling the auto-generated decoder function. + instr.clear(); DecodeStatus Result = decodeInstruction(DecoderTable16, instr, insn16, Address, this, STI); if (Result != Fail) { @@ -759,6 +760,7 @@ } // Calling the auto-generated decoder function. + instr.clear(); Result = decodeInstruction(DecoderTable32, instr, insn32, Address, this, STI); if (Result != Fail) { Size = 4;