Index: lib/CodeGen/MachineInstr.cpp =================================================================== --- lib/CodeGen/MachineInstr.cpp (revision 163653) +++ lib/CodeGen/MachineInstr.cpp (working copy) @@ -834,7 +834,8 @@ // If opcodes or number of operands are not the same then the two // instructions are obviously not identical. if (Other->getOpcode() != getOpcode() || - Other->getNumOperands() != getNumOperands()) + Other->getNumOperands() != getNumOperands() || + Other->memoperands_empty() != memoperands_empty()) return false; if (isBundle()) { @@ -850,6 +851,20 @@ } } + if (!memoperands_empty()) { + // If we have mem operands, make sure that the sizes of the memoperands for + // each MI are the same. The values can be different, so lets only check + // the sizes. If the sizes between one of the memoperands differ, then the + // instructions are not identical. + for (MachineInstr::mmo_iterator mb1 = memoperands_begin(), + mb2 = Other->memoperands_begin(), + me = memoperands_end(); mb1 != me; ++mb1, ++mb2) { + if ((*mb1)->getSize() != (*mb2)->getSize()) { + return false; + } + } + } + // Check operands to make sure they match. for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { const MachineOperand &MO = getOperand(i);