File tree 1 file changed +7
-14
lines changed
1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -9185,21 +9185,14 @@ AArch64InstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
9185
9185
// and zero immediate operands used as an alias for mov instruction.
9186
9186
if (MI.getOpcode () == AArch64::ORRWrs &&
9187
9187
MI.getOperand (1 ).getReg () == AArch64::WZR &&
9188
- MI.getOperand (3 ).getImm () == 0x0 ) {
9189
- Register Reg0 = MI.getOperand (0 ).getReg ();
9190
- // ORRWrs is copy instruction when there's no implicit def of the X
9191
- // register.
9192
- if (Reg0.isPhysical ()) {
9193
- const MachineFunction *MF = MI.getMF ();
9194
- const TargetRegisterInfo *TRI = MF->getSubtarget ().getRegisterInfo ();
9195
- for (const MachineOperand &MO : MI.implicit_operands ())
9196
- if (MO.isDef () && MO.isImplicit () &&
9197
- TRI->isSubRegister (MO.getReg (), Reg0)) {
9198
- return std::nullopt;
9199
- }
9200
- }
9188
+ MI.getOperand (3 ).getImm () == 0x0 &&
9189
+ // Check that the w->w move is not a zero-extending w->x mov.
9190
+ (!MI.getOperand (0 ).getReg ().isVirtual () ||
9191
+ MI.getOperand (0 ).getSubReg () == 0 ) &&
9192
+ (!MI.getOperand (0 ).getReg ().isPhysical () ||
9193
+ MI.findRegisterDefOperandIdx (MI.getOperand (0 ).getReg () - AArch64::W0 +
9194
+ AArch64::X0) == -1 ))
9201
9195
return DestSourcePair{MI.getOperand (0 ), MI.getOperand (2 )};
9202
- }
9203
9196
9204
9197
if (MI.getOpcode () == AArch64::ORRXrs &&
9205
9198
MI.getOperand (1 ).getReg () == AArch64::XZR &&
You can’t perform that action at this time.
0 commit comments