Skip to content

Commit 736ba3a

Browse files
committed
Update only the ORRWrs branch
1 parent fc94442 commit 736ba3a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9180,15 +9180,12 @@ void AArch64InstrInfo::buildClearRegister(Register Reg, MachineBasicBlock &MBB,
91809180

91819181
std::optional<DestSourcePair>
91829182
AArch64InstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
9183+
91839184
// AArch64::ORRWrs and AArch64::ORRXrs with WZR/XZR reg
91849185
// and zero immediate operands used as an alias for mov instruction.
9185-
bool OpIsORRWrs = MI.getOpcode() == AArch64::ORRWrs;
9186-
bool OpIsORRXrs = MI.getOpcode() == AArch64::ORRXrs;
9187-
if (!(OpIsORRWrs || OpIsORRXrs) || MI.getOperand(3).getImm() != 0x0)
9188-
return std::nullopt;
9189-
Register Reg1 = MI.getOperand(1).getReg();
9190-
9191-
if (OpIsORRWrs && Reg1 == AArch64::WZR) {
9186+
if (MI.getOpcode() == AArch64::ORRWrs &&
9187+
MI.getOperand(1).getReg() == AArch64::WZR &&
9188+
MI.getOperand(3).getImm() == 0x0) {
91929189
Register Reg0 = MI.getOperand(0).getReg();
91939190
// ORRWrs is copy instruction when there's no implicit def of the X
91949191
// register.
@@ -9204,9 +9201,10 @@ AArch64InstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
92049201
return DestSourcePair{MI.getOperand(0), MI.getOperand(2)};
92059202
}
92069203

9207-
if (OpIsORRXrs && Reg1 == AArch64::XZR) {
9204+
if (MI.getOpcode() == AArch64::ORRXrs &&
9205+
MI.getOperand(1).getReg() == AArch64::XZR &&
9206+
MI.getOperand(3).getImm() == 0x0)
92089207
return DestSourcePair{MI.getOperand(0), MI.getOperand(2)};
9209-
}
92109208

92119209
return std::nullopt;
92129210
}

0 commit comments

Comments
 (0)