summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2018-02-19 08:28:38 +0000
committerDylan McKay <me@dylanmckay.io>2018-02-19 08:28:38 +0000
commit05d3e4107699e3e3591060387b0aa24dd6a93eef (patch)
tree8215662a9011b41095150bd2f719f92f823d0742 /llvm/lib
parent8fad26e5f3641abbe3c335131ccb51cfd98649e7 (diff)
downloadbcm5719-llvm-05d3e4107699e3e3591060387b0aa24dd6a93eef.tar.gz
bcm5719-llvm-05d3e4107699e3e3591060387b0aa24dd6a93eef.zip
[AVR] Fix a lowering bug in AVRISelLowering.cpp
The parseFunctionArgs() method was directly reading the arguments from a Function object, but is should have used the arguments supplied by the SelectionDAGBuilder. This was causing the lowering code to only lower one argument, not two in some cases. Thanks to @brainlag on GitHub for coming up with the working fix! Patch-by: @brainlag on GitHub llvm-svn: 325474
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AVR/AVRISelLowering.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/AVR/AVRISelLowering.cpp b/llvm/lib/Target/AVR/AVRISelLowering.cpp
index d9e27e91405..7ac8a136e6b 100644
--- a/llvm/lib/Target/AVR/AVRISelLowering.cpp
+++ b/llvm/lib/Target/AVR/AVRISelLowering.cpp
@@ -867,10 +867,12 @@ bool AVRTargetLowering::isOffsetFoldingLegal(
/// For each argument in a function store the number of pieces it is composed
/// of.
-static void parseFunctionArgs(const Function *F, const DataLayout *TD,
+static void parseFunctionArgs(const SmallVectorImpl<ISD::InputArg> &Ins,
SmallVectorImpl<unsigned> &Out) {
- for (Argument const &Arg : F->args()) {
- unsigned Bytes = (TD->getTypeSizeInBits(Arg.getType()) + 7) / 8;
+ for (const ISD::InputArg &Arg : Ins) {
+ if(Arg.PartOffset > 0) continue;
+ unsigned Bytes = ((Arg.ArgVT.getSizeInBits()) + 7) / 8;
+
Out.push_back((Bytes + 1) / 2);
}
}
@@ -938,7 +940,7 @@ static void analyzeStandardArguments(TargetLowering::CallLoweringInfo *CLI,
parseExternFuncCallArgs(*Outs, Args);
} else {
assert(F != nullptr && "function should not be null");
- parseFunctionArgs(F, TD, Args);
+ parseFunctionArgs(*Ins, Args);
}
unsigned RegsLeft = array_lengthof(RegList8), ValNo = 0;
OpenPOWER on IntegriCloud