Skip to content

Commit e1db6b8

Browse files
committed
[AMDGPU][LowerBufferFatPointers] Fix lack of rewrite when loading/storing null
Fixes #154056. The fat buffer lowering pass was erroniously detecting that it did not need to run on functions that only load/store to the null constant (or other such constants). We thought this would be covered by specilaizing constants out to instructions, but that doesn't account foc trivial constants like null. Therefoe, we check the operands of instructions for buffer fat pointers in order to find such constants and ensure the pass runs.
1 parent 2a02147 commit e1db6b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,12 @@ static bool containsBufferFatPointers(const Function &F,
23662366
BufferFatPtrToStructTypeMap *TypeMap) {
23672367
bool HasFatPointers = false;
23682368
for (const BasicBlock &BB : F)
2369-
for (const Instruction &I : BB)
2369+
for (const Instruction &I : BB) {
23702370
HasFatPointers |= (I.getType() != TypeMap->remapType(I.getType()));
2371+
// Catch null pointer constasts in loads, stores, etc.
2372+
for (const Value *V : I.operand_values())
2373+
HasFatPointers |= (V->getType() != TypeMap->remapType(V->getType()));
2374+
}
23712375
return HasFatPointers;
23722376
}
23732377

0 commit comments

Comments
 (0)