[llvm] [llvm][NVPTX] Inform that 'DYNAMIC_STACKALLOC' is unsupported (PR #74684)
Youngsuk Kim via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 07:11:13 PST 2023
https://github.com/JOE1994 updated https://github.com/llvm/llvm-project/pull/74684
>From f176341c676c3c2bd75dcf1c2afc4ce78d7c75da Mon Sep 17 00:00:00 2001
From: Youngsuk Kim <youngsuk.kim at hpe.com>
Date: Wed, 6 Dec 2023 18:38:00 -0600
Subject: [PATCH] [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
---
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 61285c6ba98df..b62072dc796e7 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -639,6 +639,11 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
setOperationAction(ISD::ConstantFP, MVT::f16, Legal);
setOperationAction(ISD::ConstantFP, MVT::bf16, Legal);
+ // Lowering of DYNAMIC_STACKALLOC is unsupported.
+ // Custom lower to produce an error.
+ setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
+ setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Custom);
+
// TRAP can be lowered to PTX trap
setOperationAction(ISD::TRAP, MVT::Other, Legal);
@@ -2652,6 +2657,9 @@ NVPTXTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
case ISD::SREM:
case ISD::UREM:
return LowerVectorArith(Op, DAG);
+ case ISD::DYNAMIC_STACKALLOC:
+ report_fatal_error(
+ "Dynamic stack allocation is yet unsupported by NVPTX backend.");
default:
llvm_unreachable("Custom lowering not defined for operation");
}
More information about the llvm-commits
mailing list