diff options
author | Diana Picus <diana.picus@linaro.org> | 2016-05-23 12:33:34 +0000 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2016-05-23 12:33:34 +0000 |
commit | a466b7ce58c770935bf497a5bbd1d0633b304786 (patch) | |
tree | d576ea01486fd2fdad2c9aaad98cc93fcd089541 /lib/Target/BPF | |
parent | 3c9099dfec14c7c453c40e2750a3d674926fd5a8 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270419 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/BPF')
-rw-r--r-- | lib/Target/BPF/BPFISelLowering.cpp | 9 | ||||
-rw-r--r-- | lib/Target/BPF/BPFISelLowering.h | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/Target/BPF/BPFISelLowering.cpp b/lib/Target/BPF/BPFISelLowering.cpp index 066dc5e31e1..d5ace85b8e5 100644 --- a/lib/Target/BPF/BPFISelLowering.cpp +++ b/lib/Target/BPF/BPFISelLowering.cpp @@ -209,6 +209,8 @@ SDValue BPFTargetLowering::LowerFormalArguments( return Chain; } +const unsigned long 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,10 @@ 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(ArgLocs.size(), MaxArgs); i != e; ++i) { CCValAssign &VA = ArgLocs[i]; SDValue Arg = OutVals[i]; diff --git a/lib/Target/BPF/BPFISelLowering.h b/lib/Target/BPF/BPFISelLowering.h index ec71dca2fae..8663b67a7f0 100644 --- a/lib/Target/BPF/BPFISelLowering.h +++ b/lib/Target/BPF/BPFISelLowering.h @@ -58,6 +58,9 @@ private: SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const; + // Maximum number of arguments to a call + static const unsigned long MaxArgs; + // Lower a call into CALLSEQ_START - BPFISD:CALL - CALLSEQ_END chain SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl<SDValue> &InVals) const override; |