forked from OSchip/llvm-project
[BPF] Remove exit-on-error flag in test (PR27766)
The exit-on-error flag on the many_args1.ll test is needed to avoid an unreachable in BPFTargetLowering::LowerCall. We can also avoid it by ignoring any superfluous arguments to the call (i.e. any arguments after the first 5). Fixes PR27766. Differential Revision: http://reviews.llvm.org/D20471 v2 of r270419 llvm-svn: 270440
This commit is contained in:
parent
e73bf3cfff
commit
b2da61196e
|
@ -209,6 +209,8 @@ SDValue BPFTargetLowering::LowerFormalArguments(
|
|||
return Chain;
|
||||
}
|
||||
|
||||
const unsigned BPFTargetLowering::MaxArgs = 5;
|
||||
|
||||
SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
SmallVectorImpl<SDValue> &InVals) const {
|
||||
SelectionDAG &DAG = CLI.DAG;
|
||||
|
@ -241,9 +243,8 @@ SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
|||
|
||||
unsigned NumBytes = CCInfo.getNextStackOffset();
|
||||
|
||||
if (Outs.size() >= 6) {
|
||||
if (Outs.size() > MaxArgs)
|
||||
fail(CLI.DL, DAG, "too many args to ", Callee);
|
||||
}
|
||||
|
||||
for (auto &Arg : Outs) {
|
||||
ISD::ArgFlagsTy Flags = Arg.Flags;
|
||||
|
@ -257,10 +258,12 @@ SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
|||
Chain = DAG.getCALLSEQ_START(
|
||||
Chain, DAG.getConstant(NumBytes, CLI.DL, PtrVT, true), CLI.DL);
|
||||
|
||||
SmallVector<std::pair<unsigned, SDValue>, 5> RegsToPass;
|
||||
SmallVector<std::pair<unsigned, SDValue>, MaxArgs> RegsToPass;
|
||||
|
||||
// Walk arg assignments
|
||||
for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
|
||||
for (unsigned i = 0,
|
||||
e = std::min(static_cast<unsigned>(ArgLocs.size()), MaxArgs);
|
||||
i != e; ++i) {
|
||||
CCValAssign &VA = ArgLocs[i];
|
||||
SDValue Arg = OutVals[i];
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ private:
|
|||
SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDValue> &InVals) const;
|
||||
|
||||
// Maximum number of arguments to a call
|
||||
static const unsigned MaxArgs;
|
||||
|
||||
// Lower a call into CALLSEQ_START - BPFISD:CALL - CALLSEQ_END chain
|
||||
SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
SmallVectorImpl<SDValue> &InVals) const override;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: not llc -march=bpf -exit-on-error < %s 2> %t1
|
||||
; RUN: not llc -march=bpf < %s 2> %t1
|
||||
; RUN: FileCheck %s < %t1
|
||||
; CHECK: too many args
|
||||
|
||||
|
|
Loading…
Reference in New Issue