[llvm] [AMDGPU] Prevent folding of flat_scr_base_hi into a 64-bit SALU (PR #170373)
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 3 11:19:51 PST 2025
================
@@ -6256,6 +6256,17 @@ bool SIInstrInfo::isLegalRegOperand(const MachineInstr &MI, unsigned OpIdx,
(int)OpIdx == AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::src0) &&
RI.isSGPRReg(MRI, MO.getReg()))
return false;
+
+ if (ST.hasFlatScratchHiInB64InstHazard() &&
+ MO.getReg() == AMDGPU::SRC_FLAT_SCRATCH_BASE_HI && isSALU(MI)) {
+ if (const MachineOperand *Dst = getNamedOperand(MI, AMDGPU::OpName::sdst)) {
+ if (AMDGPU::getRegBitWidth(*MRI.getRegClass(Dst->getReg())) == 64)
----------------
rampitec wrote:
Well, should not we then just iterate all operands in the `verifyInstruction()` and call `isOperandLegal()`? Why would we duplicate the code?
https://github.com/llvm/llvm-project/pull/170373
More information about the llvm-commits
mailing list