@@ -341,15 +341,15 @@ bool RISCVExpandPseudo::expandRV32ZdinxStore(MachineBasicBlock &MBB,
341
341
.addImm (MBBI->getOperand (2 ).getImm () + 4 );
342
342
}
343
343
344
- if (!MBBI->memoperands_empty ()) {
345
- assert (MBBI->hasOneMemOperand () && " Expected mem operand" );
346
- MachineMemOperand *OldMMO = MBBI->memoperands ().front ();
347
- MachineFunction *MF = MBB.getParent ();
348
- MachineMemOperand *MMOLo = MF->getMachineMemOperand (OldMMO, 0 , 4 );
349
- MachineMemOperand *MMOHi = MF->getMachineMemOperand (OldMMO, 4 , 4 );
350
- MIBLo.setMemRefs (MMOLo);
351
- MIBHi.setMemRefs (MMOHi);
344
+ MachineFunction *MF = MBB.getParent ();
345
+ SmallVector<MachineMemOperand *> NewLoMMOs;
346
+ SmallVector<MachineMemOperand *> NewHiMMOs;
347
+ for (const MachineMemOperand *MMO : MBBI->memoperands ()) {
348
+ NewLoMMOs.push_back (MF->getMachineMemOperand (MMO, 0 , 4 ));
349
+ NewHiMMOs.push_back (MF->getMachineMemOperand (MMO, 4 , 4 ));
352
350
}
351
+ MIBLo.setMemRefs (NewLoMMOs);
352
+ MIBHi.setMemRefs (NewHiMMOs);
353
353
354
354
MBBI->eraseFromParent ();
355
355
return true ;
@@ -401,15 +401,15 @@ bool RISCVExpandPseudo::expandRV32ZdinxLoad(MachineBasicBlock &MBB,
401
401
.add (MBBI->getOperand (2 ));
402
402
}
403
403
404
- if (!MBBI->memoperands_empty ()) {
405
- assert (MBBI->hasOneMemOperand () && " Expected mem operand" );
406
- MachineMemOperand *OldMMO = MBBI->memoperands ().front ();
407
- MachineFunction *MF = MBB.getParent ();
408
- MachineMemOperand *MMOLo = MF->getMachineMemOperand (OldMMO, 0 , 4 );
409
- MachineMemOperand *MMOHi = MF->getMachineMemOperand (OldMMO, 4 , 4 );
410
- MIBLo.setMemRefs (MMOLo);
411
- MIBHi.setMemRefs (MMOHi);
404
+ MachineFunction *MF = MBB.getParent ();
405
+ SmallVector<MachineMemOperand *> NewLoMMOs;
406
+ SmallVector<MachineMemOperand *> NewHiMMOs;
407
+ for (const MachineMemOperand *MMO : MBBI->memoperands ()) {
408
+ NewLoMMOs.push_back (MF->getMachineMemOperand (MMO, 0 , 4 ));
409
+ NewHiMMOs.push_back (MF->getMachineMemOperand (MMO, 4 , 4 ));
412
410
}
411
+ MIBLo.setMemRefs (NewLoMMOs);
412
+ MIBHi.setMemRefs (NewHiMMOs);
413
413
414
414
MBBI->eraseFromParent ();
415
415
return true ;
0 commit comments