1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

AMDGPU: Fix crash with dispatch.ptr intrinsic with non-HSA target

It might be better to let this be a select failure instead.

llvm-svn: 257386
This commit is contained in:
Matt Arsenault 2016-01-11 21:18:33 +00:00
parent 902e3a5e93
commit f903e8d6a9
2 changed files with 10 additions and 0 deletions

View File

@ -1157,6 +1157,13 @@ SDValue SITargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
switch (IntrinsicID) {
case Intrinsic::amdgcn_dispatch_ptr:
if (!Subtarget->isAmdHsaOS()) {
DiagnosticInfoUnsupported BadIntrin(*MF.getFunction(),
"hsa intrinsic without hsa target");
DAG.getContext()->diagnose(BadIntrin);
return DAG.getUNDEF(VT);
}
return CreateLiveInRegister(DAG, &AMDGPU::SReg_64RegClass,
TRI->getPreloadedValue(MF, SIRegisterInfo::DISPATCH_PTR), VT);

View File

@ -1,4 +1,7 @@
; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
; RUN: not llc -mtriple=amdgcn-unknown-unknown -mcpu=kaveri -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=ERROR %s
; ERROR: error: unsupported hsa intrinsic without hsa target in test
; GCN-LABEL: {{^}}test:
; GCN: enable_sgpr_dispatch_ptr = 1