mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
AMDGPU: Produce error on dynamic_stackalloc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246048 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d4213e9ee8
commit
ca675427d2
@ -113,6 +113,9 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(TargetMachine &TM,
|
||||
setOperationAction(ISD::BR_JT, MVT::Other, Expand);
|
||||
setOperationAction(ISD::BRIND, MVT::Other, Expand);
|
||||
|
||||
// This is totally unsupported, just custom lower to produce an error.
|
||||
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
|
||||
|
||||
// We need to custom lower some of the intrinsics
|
||||
setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom);
|
||||
|
||||
@ -613,6 +616,15 @@ SDValue AMDGPUTargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
SDValue AMDGPUTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
|
||||
SelectionDAG &DAG) const {
|
||||
const Function &Fn = *DAG.getMachineFunction().getFunction();
|
||||
|
||||
DiagnosticInfoUnsupported NoDynamicAlloca(Fn, "dynamic alloca");
|
||||
DAG.getContext()->diagnose(NoDynamicAlloca);
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
SDValue AMDGPUTargetLowering::LowerOperation(SDValue Op,
|
||||
SelectionDAG &DAG) const {
|
||||
switch (Op.getOpcode()) {
|
||||
@ -639,6 +651,7 @@ SDValue AMDGPUTargetLowering::LowerOperation(SDValue Op,
|
||||
case ISD::UINT_TO_FP: return LowerUINT_TO_FP(Op, DAG);
|
||||
case ISD::FP_TO_SINT: return LowerFP_TO_SINT(Op, DAG);
|
||||
case ISD::FP_TO_UINT: return LowerFP_TO_UINT(Op, DAG);
|
||||
case ISD::DYNAMIC_STACKALLOC: return LowerDYNAMIC_STACKALLOC(Op, DAG);
|
||||
}
|
||||
return Op;
|
||||
}
|
||||
|
@ -149,6 +149,9 @@ public:
|
||||
SDValue LowerCall(CallLoweringInfo &CLI,
|
||||
SmallVectorImpl<SDValue> &InVals) const override;
|
||||
|
||||
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op,
|
||||
SelectionDAG &DAG) const;
|
||||
|
||||
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
|
||||
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
|
||||
void ReplaceNodeResults(SDNode * N,
|
||||
|
@ -276,6 +276,9 @@ static bool collectUsesWithPtrTypes(Value *Val, std::vector<Value*> &WorkList) {
|
||||
}
|
||||
|
||||
void AMDGPUPromoteAlloca::visitAlloca(AllocaInst &I) {
|
||||
if (!I.isStaticAlloca())
|
||||
return;
|
||||
|
||||
IRBuilder<> Builder(&I);
|
||||
|
||||
// First try to replace the alloca with a vector
|
||||
|
11
test/CodeGen/AMDGPU/dynamic_stackalloc.ll
Normal file
11
test/CodeGen/AMDGPU/dynamic_stackalloc.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; RUN: not llc -march=amdgcn -mcpu=tahiti -mattr=+promote-alloca -verify-machineinstrs < %s 2>&1 | FileCheck %s
|
||||
; RUN: not llc -march=amdgcn -mcpu=tahiti -mattr=-promote-alloca -verify-machineinstrs < %s 2>&1 | FileCheck %s
|
||||
; RUN: not llc -march=r600 -mcpu=cypress < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: error: unsupported dynamic alloca in test_dynamic_stackalloc
|
||||
|
||||
define void @test_dynamic_stackalloc(i32 addrspace(1)* %out, i32 %n) {
|
||||
%alloca = alloca i32, i32 %n
|
||||
store volatile i32 0, i32* %alloca
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user