[llvm] [AMDGPU] Disable SDWA destination selection combining (PR #218512)

Frederik Harwath via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 07:00:50 PDT 2026


================
@@ -309,24 +309,27 @@ static MachineOperand *findSingleRegDef(const MachineOperand *Reg,
   return MRI->getOneDef(Reg->getReg());
 }
 
-/// Combine an SDWA instruction's existing SDWA selection \p Sel with
+/// Combine an SDWA instruction's existing source selection \p Sel with
 /// the SDWA selection \p OperandSel of its operand. If the selections
 /// are compatible, return the combined selection, otherwise return a
-/// nullopt.
+/// nullopt. Destination selections are never composed, see
+/// SDWADstOperand::canCombineSelections.
 /// For example, if we have Sel = BYTE_0 Sel and OperandSel = WORD_1:
 ///     BYTE_0 Sel (WORD_1 Sel (%X)) -> BYTE_2 Sel (%X)
 static std::optional<SdwaSel> combineSdwaSel(SdwaSel Sel, SdwaSel OperandSel) {
   if (Sel == SdwaSel::DWORD)
     return OperandSel;
 
-  if (Sel == OperandSel || OperandSel == SdwaSel::DWORD)
----------------
frederik-h wrote:

To answer my own question: The changes are also necessary for source selections. I think the PR description/later commit message should summarize the intentions of all changes.

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


More information about the llvm-commits mailing list