[llvm] [AArch64] Avoid AArch64::getSVEPseudoMap calls on non-SVE targets (PR #191395)
Cullen Rhodes via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 05:46:11 PDT 2026
================
@@ -1375,14 +1375,20 @@ bool AArch64ExpandPseudoImpl::expandMI(MachineBasicBlock &MBB,
MachineBasicBlock::iterator &NextMBBI) {
MachineInstr &MI = *MBBI;
unsigned Opcode = MI.getOpcode();
-
- // Check if we can expand the destructive op
- int OrigInstr = AArch64::getSVEPseudoMap(MI.getOpcode());
- if (OrigInstr != -1) {
- auto &Orig = TII->get(OrigInstr);
- if ((Orig.TSFlags & AArch64::DestructiveInstTypeMask) !=
- AArch64::NotDestructive) {
- return expand_DestructiveOp(MI, MBB, MBBI);
+ const AArch64Subtarget &STI =
+ MBB.getParent()->getSubtarget<AArch64Subtarget>();
+
+ // Check if we can expand the destructive op. We check target features to
+ // avoid compile-time cost of AArch64::getSVEPseudoMap if not required by
+ // target.
+ if (STI.hasSVE() || STI.hasSME()) {
----------------
c-rhodes wrote:
I've gone with Dave's suggestion, it was missing an even simpler more obvious check for pseudos
https://github.com/llvm/llvm-project/pull/191395
More information about the llvm-commits
mailing list