Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,9 +1307,17 @@ void SelectionDAGBuilder::visitGCRelocate(const GCRelocateInst &Relocate) {

void SelectionDAGBuilder::LowerDeoptimizeCall(const CallInst *CI) {
const auto &TLI = DAG.getTargetLoweringInfo();
SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(RTLIB::DEOPTIMIZE),
TLI.getPointerTy(DAG.getDataLayout()));

RTLIB::LibcallImpl DeoptImpl = TLI.getLibcallImpl(RTLIB::DEOPTIMIZE);
if (DeoptImpl == RTLIB::Unsupported) {
DAG.getContext()->emitError("no deoptimize libcall available");
return;
}

SDValue Callee =
DAG.getExternalSymbol(DeoptImpl, TLI.getPointerTy(DAG.getDataLayout()));

// FIXME: Should pass in the calling convention for the LibcallImpl.
// We don't lower calls to __llvm_deoptimize as varargs, but as a regular
// call. We also do not lower the return value to any virtual register, and
// change the immediately following return to a trap instruction.
Expand Down
8 changes: 2 additions & 6 deletions llvm/test/CodeGen/AMDGPU/llvm.deoptimize.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s 2> %t.err | FileCheck %s
; RUN: FileCheck -check-prefix=ERR %s < %t.err
; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s 2>&1 | FileCheck %s

; ERR: error: <unknown>:0:0: in function caller_0 i32 (): unsupported external symbol
; ERR: error: unhandled statepoint-like instruction

; CHECK: ;unsupported statepoint/stackmap/patchpoint
; CHECK: error: no deoptimize libcall available
declare i32 @llvm.experimental.deoptimize.i32(...)
declare i8 @llvm.experimental.deoptimize.i8(...)

Expand Down
Loading