[llvm] [AMDGPU] Fix poison result on inttoptr a narrow integer to ptr addrspace(7) in LowerBufferFatPointers (PR #216966)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 02:32:32 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) {
----------------
arsenm wrote:

I'm assuming the equal sized case is already tested, what about wider?

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


More information about the llvm-commits mailing list