Skip to content

Commit 1f14ec2

Browse files
committed
[Attributor] Use getAllocaAddrSpace to get address space for AllocaInst
1 parent b5f7d3d commit 1f14ec2

File tree

5 files changed

+893
-286
lines changed

5 files changed

+893
-286
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12603,6 +12603,13 @@ struct AAAddressSpaceImpl : public AAAddressSpace {
1260312603
auto CheckAddressSpace = [&](Value &Obj) {
1260412604
if (isa<UndefValue>(&Obj))
1260512605
return true;
12606+
// Some targets relax the requirement for alloca to be in an exact address
12607+
// space, allowing it in certain other address spaces instead. These
12608+
// targets later lower alloca to the correct address space in the
12609+
// pipeline. Therefore, we need to query the data layout to determine the
12610+
// appropriate address space.
12611+
if (isa<AllocaInst>(&Obj))
12612+
return takeAddressSpace(A.getDataLayout().getAllocaAddrSpace());
1260612613
// If an argument in flat address space only has addrspace cast uses, and
1260712614
// those casts are same, then we take the dst addrspace.
1260812615
if (auto *Arg = dyn_cast<Argument>(&Obj)) {

0 commit comments

Comments
 (0)