[llvm] r315457 - [TargetLowering] Correctly track NumFixedArgs field of CallLoweringInfo
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 11 06:48:45 PDT 2017
Author: asb
Date: Wed Oct 11 06:48:45 2017
New Revision: 315457
URL: http://llvm.org/viewvc/llvm-project?rev=315457&view=rev
Log:
[TargetLowering] Correctly track NumFixedArgs field of CallLoweringInfo
The NumFixedArgs field of CallLoweringInfo is used by
TargetLowering::LowerCallTo to determine whether a given argument is passed
using the vararg calling convention or not (specifically, to set IsFixed for
each ISD::OutputArg).
Firstly, CallLoweringInfo::setLibCallee and CallLoweringInfo::setCallee both
incorrectly set NumFixedArgs based on the _previous_ args list. Secondly,
TargetLowering::LowerCallTo failed to increment NumFixedArgs when modifying
the argument list so a pointer is passed for the return value.
If your backend uses the IsFixed property or directly accesses NumFixedArgs,
it is _possible_ this change could result in codegen changes (although the
previous behaviour would have been incorrect). No such cases have been
identified during code review for any in-tree architecture.
Differential Revision: https://reviews.llvm.org/D37898
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=315457&r1=315456&r2=315457&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Oct 11 06:48:45 2017
@@ -2907,7 +2907,7 @@ public:
RetTy = ResultType;
Callee = Target;
CallConv = CC;
- NumFixedArgs = Args.size();
+ NumFixedArgs = ArgsList.size();
Args = std::move(ArgsList);
DAG.getTargetLoweringInfo().markLibCallAttributes(
@@ -2920,7 +2920,7 @@ public:
RetTy = ResultType;
Callee = Target;
CallConv = CC;
- NumFixedArgs = Args.size();
+ NumFixedArgs = ArgsList.size();
Args = std::move(ArgsList);
return *this;
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=315457&r1=315456&r2=315457&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Oct 11 06:48:45 2017
@@ -8077,6 +8077,7 @@ TargetLowering::LowerCallTo(TargetLoweri
Entry.IsSwiftError = false;
Entry.Alignment = Align;
CLI.getArgs().insert(CLI.getArgs().begin(), Entry);
+ CLI.NumFixedArgs += 1;
CLI.RetTy = Type::getVoidTy(CLI.RetTy->getContext());
// sret demotion isn't compatible with tail-calls, since the sret argument
More information about the llvm-commits
mailing list