summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/BPF
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2016-05-23 14:57:19 +0000
committerDiana Picus <diana.picus@linaro.org>2016-05-23 14:57:19 +0000
commitb2da61196ea8491ef88b0325cf3dee963aface1c (patch)
treeb83a2a5d74c9d89a0a09e4dde90fe9d17cb25ea8 /llvm/lib/Target/BPF
parente73bf3cfff1682f9e18477c5f1a180184881fbd7 (diff)
downloadbcm5719-llvm-b2da61196ea8491ef88b0325cf3dee963aface1c.tar.gz
bcm5719-llvm-b2da61196ea8491ef88b0325cf3dee963aface1c.zip
[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
Diffstat (limited to 'llvm/lib/Target/BPF')
-rw-r--r--llvm/lib/Target/BPF/BPFISelLowering.cpp11
-rw-r--r--llvm/lib/Target/BPF/BPFISelLowering.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Target/BPF/BPFISelLowering.cpp b/llvm/lib/Target/BPF/BPFISelLowering.cpp
index 066dc5e31e1..b2e4783b3ef 100644
--- a/llvm/lib/Target/BPF/BPFISelLowering.cpp
+++ b/llvm/lib/Target/BPF/BPFISelLowering.cpp
@@ -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];
diff --git a/llvm/lib/Target/BPF/BPFISelLowering.h b/llvm/lib/Target/BPF/BPFISelLowering.h
index ec71dca2fae..8dc71903490 100644
--- a/llvm/lib/Target/BPF/BPFISelLowering.h
+++ b/llvm/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 MaxArgs;
+
// Lower a call into CALLSEQ_START - BPFISD:CALL - CALLSEQ_END chain
SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI,
SmallVectorImpl<SDValue> &InVals) const override;
OpenPOWER on IntegriCloud