forked from OSchip/llvm-project
[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
This commit is contained in:
parent
8fad26e5f3
commit
05d3e41076
|
@ -867,10 +867,12 @@ bool AVRTargetLowering::isOffsetFoldingLegal(
|
||||||
|
|
||||||
/// For each argument in a function store the number of pieces it is composed
|
/// For each argument in a function store the number of pieces it is composed
|
||||||
/// of.
|
/// of.
|
||||||
static void parseFunctionArgs(const Function *F, const DataLayout *TD,
|
static void parseFunctionArgs(const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||||
SmallVectorImpl<unsigned> &Out) {
|
SmallVectorImpl<unsigned> &Out) {
|
||||||
for (Argument const &Arg : F->args()) {
|
for (const ISD::InputArg &Arg : Ins) {
|
||||||
unsigned Bytes = (TD->getTypeSizeInBits(Arg.getType()) + 7) / 8;
|
if(Arg.PartOffset > 0) continue;
|
||||||
|
unsigned Bytes = ((Arg.ArgVT.getSizeInBits()) + 7) / 8;
|
||||||
|
|
||||||
Out.push_back((Bytes + 1) / 2);
|
Out.push_back((Bytes + 1) / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -938,7 +940,7 @@ static void analyzeStandardArguments(TargetLowering::CallLoweringInfo *CLI,
|
||||||
parseExternFuncCallArgs(*Outs, Args);
|
parseExternFuncCallArgs(*Outs, Args);
|
||||||
} else {
|
} else {
|
||||||
assert(F != nullptr && "function should not be null");
|
assert(F != nullptr && "function should not be null");
|
||||||
parseFunctionArgs(F, TD, Args);
|
parseFunctionArgs(*Ins, Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned RegsLeft = array_lengthof(RegList8), ValNo = 0;
|
unsigned RegsLeft = array_lengthof(RegList8), ValNo = 0;
|
||||||
|
|
Loading…
Reference in New Issue