summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-05-24 16:52:35 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-05-24 16:52:35 +0000
commit0ff901fba0ae5ca950a23c3b993240b62877f42f (patch)
tree81bbdfe13608c149cc2fdf1d5a4f319da25deda0 /llvm/lib/Target
parent6f7734a1255975125c1ceb9b14adfd17ee7be177 (diff)
downloadbcm5719-llvm-0ff901fba0ae5ca950a23c3b993240b62877f42f.tar.gz
bcm5719-llvm-0ff901fba0ae5ca950a23c3b993240b62877f42f.zip
AMDGPU: Boost inline threshold with addrspacecasted alloca arguments
This was skipping GetUnderlyingObject for nonprivate addresses, but an alloca could also be found through an addrspacecast if it's flat. llvm-svn: 361649
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUInline.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
index 84419a147c8..22c7c0d51f4 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
@@ -123,10 +123,11 @@ unsigned AMDGPUInliner::getInlineThreshold(CallSite CS) const {
uint64_t AllocaSize = 0;
SmallPtrSet<const AllocaInst *, 8> AIVisited;
for (Value *PtrArg : CS.args()) {
- Type *Ty = PtrArg->getType();
- if (!Ty->isPointerTy() ||
- Ty->getPointerAddressSpace() != AMDGPUAS::PRIVATE_ADDRESS)
+ PointerType *Ty = dyn_cast<PointerType>(PtrArg->getType());
+ if (!Ty || (Ty->getAddressSpace() != AMDGPUAS::PRIVATE_ADDRESS &&
+ Ty->getAddressSpace() != AMDGPUAS::FLAT_ADDRESS))
continue;
+
PtrArg = GetUnderlyingObject(PtrArg, DL);
if (const AllocaInst *AI = dyn_cast<AllocaInst>(PtrArg)) {
if (!AI->isStaticAlloca() || !AIVisited.insert(AI).second)
OpenPOWER on IntegriCloud