[llvm] [AMDGPU] Ensure positive InstOffset for buffer operations (PR #145504)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 06:37:41 PDT 2025


================
@@ -4547,6 +4548,16 @@ bool AMDGPUAsmParser::validateSMEMOffset(const MCInst &Inst,
 
   uint64_t Offset = Op.getImm();
   bool IsBuffer = AMDGPU::getSMEMIsBuffer(Opcode);
+  // GFX12+ S_BUFFER_*: InstOffset is signed 24, but must be positive
+  if (isGFX12Plus() && IsBuffer) {
+    const unsigned OffsetSize = 24;
----------------
shiltian wrote:

nit:
```suggestion
    constexpr const unsigned OffsetSize = 24;
```

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


More information about the llvm-commits mailing list