[llvm] [AMDGPU] Fix poison result on inttoptr a narrow integer to ptr addrspace(7) in LowerBufferFatPointers (PR #216966)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 02:55:47 PDT 2026
================
@@ -2224,10 +2224,17 @@ PtrParts SplitPtrStructs::visitIntToPtrInst(IntToPtrInst &IP) {
auto *RetTy = cast<StructType>(IP.getType());
Type *RsrcTy = RetTy->getElementType(0);
Type *OffTy = RetTy->getElementType(1);
- Value *RsrcPart = IRB.CreateLShr(
- Int,
- ConstantExpr::getIntegerValue(IntTy, APInt(Width, BufferOffsetWidth)));
- Value *RsrcInt = IRB.CreateIntCast(RsrcPart, RsrcIntTy, /*isSigned=*/false);
+ // inttoptr zero-extends, so narrow inputs contribute nothing to the resource
+ // part.
+ Value *RsrcInt;
+ if (Width <= BufferOffsetWidth) {
----------------
aobolensk wrote:
Yes, there are tests for wider: https://github.com/llvm/llvm-project/blob/c6057e9f657649e6c77014952d268469f603872a/llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-pointer-ops.ll#L308-L351
for equal as well
https://github.com/llvm/llvm-project/pull/216966
More information about the llvm-commits
mailing list