[llvm] [AMDGPU][MachineVerifier] test failures in SIFoldOperands (PR #166600)
Abhay Kanhere via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 5 09:54:00 PST 2025
https://github.com/AbhayKanhere created https://github.com/llvm/llvm-project/pull/166600
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.
>From c37f1d1f49111bc2e818de8592270566355bdd90 Mon Sep 17 00:00:00 2001
From: Abhay Kanhere <abhay at kanhere.net>
Date: Wed, 5 Nov 2025 09:51:02 -0800
Subject: [PATCH] [AMDGPU][MachineVerifier] test failures in SIFoldOperands
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.
---
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 4 ++++
1 file changed, 4 insertions(+)
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;
}
More information about the llvm-commits
mailing list