+ MO.setIndex(NewFI);
+
+ // Update the MachineMemOperand for the new memory location.
+ // FIXME: We need a better method of managing these too.
+ SmallVector<MachineMemOperand, 2> MMOs(MI.memoperands_begin(),
+ MI.memoperands_end());
+ MI.clearMemOperands(MF);
+ const Value *OldSV = PseudoSourceValue::getFixedStack(FI);
+ for (unsigned i = 0, e = MMOs.size(); i != e; ++i) {
+ if (MMOs[i].getValue() == OldSV) {
+ MachineMemOperand MMO(PseudoSourceValue::getFixedStack(NewFI),
+ MMOs[i].getFlags(), MMOs[i].getOffset(),
+ MMOs[i].getSize(), MMOs[i].getAlignment());
+ MI.addMemOperand(MF, MMO);
+ } else
+ MI.addMemOperand(MF, MMOs[i]);
+ }