[llvm] [AMDGPU][MachineVerifier] test failures in SIFoldOperands (PR #166600)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 09:54:31 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Abhay Kanhere (AbhayKanhere)

<details>
<summary>Changes</summary>

After PR:https://github.com/llvm/llvm-project/pull/151421 merged following fails in SIFoldOperands showed up.

LLVM :: CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.mfma.gfx90a.ll
LLVM :: CodeGen/AMDGPU/llvm.amdgcn.mfma.gfx90a.ll
LLVM :: CodeGen/AMDGPU/llvm.amdgcn.mfma.ll
LLVM :: CodeGen/AMDGPU/mfma-loop.ll
LLVM :: CodeGen/AMDGPU/rewrite-vgpr-mfma-to-agpr.ll

In Folding code, if folded operand is register ensure earlyClobber is set.

---
Full diff: https://github.com/llvm/llvm-project/pull/166600.diff


1 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/SIFoldOperands.cpp (+4) 


``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
index 6616b30410590..cf9a6f021fd9b 100644
--- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -689,6 +689,10 @@ bool SIFoldOperandsImpl::updateOperand(FoldCandidate &Fold) const {
     if (!TII->isOperandLegal(*MI, OpNo, &New))
       return false;
 
+    const MCInstrDesc &MCID = MI->getDesc();
+    if (MCID.getOperandConstraint(OpNo, MCOI::EARLY_CLOBBER) != -1) {
+      MI->getOperand(OpNo).setIsEarlyClobber(true);
+    }
     Old.ChangeToImmediate(*ImmVal);
     return true;
   }

``````````

</details>


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


More information about the llvm-commits mailing list