From 7c8962eed846517b6963daef491fa62a36b41f55 Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Fri, 8 Aug 2025 11:48:50 -0700 Subject: [PATCH] [AMDGPU] Fix out of bound physreg tuple condition. NFC. The end register of the tuple shall be below the last existing register. The check does not work on something like {v[255:256]}. Overall it works correctly because if fails later at the getMatchingSuperReg() call. --- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 1b7d65a31635f..e866bd47e267d 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -16925,7 +16925,7 @@ SITargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI_, if (RC) { if (NumRegs > 1) { - if (Idx >= RC->getNumRegs() || Idx + NumRegs - 1 > RC->getNumRegs()) + if (Idx >= RC->getNumRegs() || Idx + NumRegs - 1 >= RC->getNumRegs()) return std::pair(0U, nullptr); uint32_t Width = NumRegs * 32;