Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 13a223e

Browse files
committed
[AMDGPU] Fix assertion due to assuming pointer in default addr space is 32 bit
The backend assumes pointer in default addr space is 32 bit, which is not true for the new addr space mapping and causes assertion for unresolved functions. This patch fixes that. Differential Revision: https://reviews.llvm.org/D39643 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317476 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent dfaa4d2 commit 13a223e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,12 +2134,17 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
21342134
}
21352135

21362136
if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Callee)) {
2137-
// FIXME: Remove this hack for function pointer types.
2138-
const GlobalValue *GV = GA->getGlobal();
2139-
assert(Callee.getValueType() == MVT::i32);
2140-
Callee = DAG.getGlobalAddress(GV, DL, MVT::i64, GA->getOffset(),
2141-
false, GA->getTargetFlags());
2137+
// FIXME: Remove this hack for function pointer types after removing
2138+
// support of old address space mapping. In the new address space
2139+
// mapping the pointer in default address space is 64 bit, therefore
2140+
// does not need this hack.
2141+
if (Callee.getValueType() == MVT::i32) {
2142+
const GlobalValue *GV = GA->getGlobal();
2143+
Callee = DAG.getGlobalAddress(GV, DL, MVT::i64, GA->getOffset(), false,
2144+
GA->getTargetFlags());
2145+
}
21422146
}
2147+
assert(Callee.getValueType() == MVT::i64);
21432148

21442149
const SIMachineFunctionInfo *Info = MF.getInfo<SIMachineFunctionInfo>();
21452150

test/CodeGen/AMDGPU/unsupported-calls.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: not llc -march=amdgcn -tailcallopt < %s 2>&1 | FileCheck -check-prefix=GCN %s
2-
; RUN: not llc -march=r600 -mcpu=cypress -tailcallopt < %s 2>&1 | FileCheck -check-prefix=R600 %s
1+
; RUN: not llc -march=amdgcn -mtriple=amdgcn---amdgiz -tailcallopt < %s 2>&1 | FileCheck -check-prefix=GCN %s
2+
; RUN: not llc -march=r600 -mtriple=r600---amdgiz -mcpu=cypress -tailcallopt < %s 2>&1 | FileCheck -check-prefix=R600 %s
33

44
declare i32 @external_function(i32) nounwind
55

0 commit comments

Comments
 (0)