[llvm] [AArch64] Define constructive EXT_ZZZI pseudo instruction (PR #152552)

Gaëtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 07:50:59 PDT 2025


================
@@ -639,10 +644,20 @@ bool AArch64ExpandPseudo::expand_DestructiveOp(
           .addImm(0);
     }
   } else if (DstReg != MI.getOperand(DOPIdx).getReg()) {
-    assert(DOPRegIsUnique && "The destructive operand should be unique");
-    PRFX = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(MovPrfx))
-               .addReg(DstReg, RegState::Define)
-               .addReg(MI.getOperand(DOPIdx).getReg(), DOPRegState);
+    if (DOPRegIsUnique) {
+      PRFX = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(MovPrfx))
+                 .addReg(DstReg, RegState::Define)
+                 .addReg(MI.getOperand(DOPIdx).getReg(), DOPRegState);
+    } else {
+      // MOVPRFX requires unique operands: Just build a COPY (Using ORR directly
+      // as we are past PostRAPseudo expansion).
+      assert(DType == AArch64::DestructiveRegRegImmUnpred &&
+             "Unexpected destructive operation type");
+      PRFX = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(AArch64::ORR_ZZZ))
----------------
gbossu wrote:

I did not notice the experimental flag, and the .ll test I had modified locally to reproduce the issue used `-mattr=+use-experimental-zeroing-pseudos`... **TLDR**: You're 100% right, and I think there are no issues with existing "constructive pseudos" at the moment 🙂

And I do understand this is a requirement to safely lower all cases. But I still think that it is useful to document why those pseudos are experimental for the next person stumbling upon the implementation

https://github.com/llvm/llvm-project/pull/152552


More information about the llvm-commits mailing list