Skip to content

Commit f176341

Browse files
committed
[llvm][NVPTX] Inform that 'DYNAMIC_STACKALLOC' is unsupported
Catch unsupported path early up, and emit error with information. Motivated by the following threads: * https://discourse.llvm.org/t/nvptx-problems-with-dynamic-alloca/70745 * #64017
1 parent f1200ca commit f176341

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,11 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
639639
setOperationAction(ISD::ConstantFP, MVT::f16, Legal);
640640
setOperationAction(ISD::ConstantFP, MVT::bf16, Legal);
641641

642+
// Lowering of DYNAMIC_STACKALLOC is unsupported.
643+
// Custom lower to produce an error.
644+
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
645+
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Custom);
646+
642647
// TRAP can be lowered to PTX trap
643648
setOperationAction(ISD::TRAP, MVT::Other, Legal);
644649

@@ -2652,6 +2657,9 @@ NVPTXTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
26522657
case ISD::SREM:
26532658
case ISD::UREM:
26542659
return LowerVectorArith(Op, DAG);
2660+
case ISD::DYNAMIC_STACKALLOC:
2661+
report_fatal_error(
2662+
"Dynamic stack allocation is yet unsupported by NVPTX backend.");
26552663
default:
26562664
llvm_unreachable("Custom lowering not defined for operation");
26572665
}

0 commit comments

Comments
 (0)