[llvm] [AMDGPU] Reject DPP combine when old is narrower than dst (PR #217894)

Mirko BrkuĊĦanin via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 05:39:39 PDT 2026


================
@@ -261,6 +261,12 @@ MachineInstr *GCNDPPCombine::createDPPInst(MachineInstr &OrigMI,
       DPPInst.addReg(CombOldVGPR.Reg, getUndefRegState(!Def),
                      CombOldVGPR.SubReg);
       ++NumOperands;
+
+      if (!TII->isOperandLegal(*DPPInst, OldIdx)) {
+        LLVM_DEBUG(dbgs() << "  failed: old operand is illegal\n");
+        Fail = true;
+        break;
+      }
----------------
mbrkusanin wrote:

There is a FIXME below about `isOperandLegal` expecting to be called on a complete instruction. `DPPInst` here is not complete.

If we just want to check sizes of old vs vdst, there is a `unsigned getOpSize(uint32_t Opcode, unsigned OpNo)` which works with opcode so it can even be done before BuildMI.

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


More information about the llvm-commits mailing list