[llvm] [AArch64] Fold scalar-to-vector shuffles into DUP/FMOV (PR #166962)
Amina Chabane via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 06:13:39 PST 2025
================
@@ -696,6 +696,15 @@ static bool is64bitDefwithZeroHigh64bit(MachineInstr *MI,
const TargetRegisterClass *RC = MRI->getRegClass(MI->getOperand(0).getReg());
if (RC != &AArch64::FPR64RegClass)
return false;
+ if (MI->getOpcode() == TargetOpcode::COPY) {
----------------
Amichaxx wrote:
Perhaps I am misunderstanding, but I believe cross-class copies are not elided due to this block in `MachineCopyPropagation::isForwardableRegClassCopy`.
```
Register UseDstReg = UseICopyOperands->Destination->getReg();
bool Found = false;
bool IsCrossClass = false;
for (const TargetRegisterClass *RC : TRI->regclasses()) {
if (RC->contains(CopySrcReg) && RC->contains(UseDstReg)) {
Found = true;
if (TRI->getCrossCopyRegClass(RC) != RC) {
IsCrossClass = true;
break;
}
}
}
if (!Found)
return false;
if (!IsCrossClass)
return true;
```
Found remains false because they share no register class and the COPY is not forwarded. After which, I believe a COPY between GPR to FPR would always become an fmov.
https://github.com/llvm/llvm-project/pull/166962
More information about the llvm-commits
mailing list