Skip to content

Commit 754ed95

Browse files
authored
[Mips] Fix compiler crash when returning fp128 after calling a functi… (#117525)
…on returning { i8, i128 } Fixes #96432.
1 parent 333562e commit 754ed95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+323
-55
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4781,7 +4781,7 @@ class TargetLowering : public TargetLoweringBase {
47814781
virtual bool CanLowerReturn(CallingConv::ID /*CallConv*/,
47824782
MachineFunction &/*MF*/, bool /*isVarArg*/,
47834783
const SmallVectorImpl<ISD::OutputArg> &/*Outs*/,
4784-
LLVMContext &/*Context*/) const
4784+
LLVMContext &/*Context*/, const Type *RetTy) const
47854785
{
47864786
// Return true by default to get preexisting behavior.
47874787
return true;

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ bool FastISel::lowerCallTo(CallLoweringInfo &CLI) {
10011001
GetReturnInfo(CLI.CallConv, CLI.RetTy, getReturnAttrs(CLI), Outs, TLI, DL);
10021002

10031003
bool CanLowerReturn = TLI.CanLowerReturn(
1004-
CLI.CallConv, *FuncInfo.MF, CLI.IsVarArg, Outs, CLI.RetTy->getContext());
1004+
CLI.CallConv, *FuncInfo.MF, CLI.IsVarArg, Outs, CLI.RetTy->getContext(), CLI.RetTy);
10051005

10061006
// FIXME: sret demotion isn't supported yet - bail out.
10071007
if (!CanLowerReturn)

llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
9999
GetReturnInfo(CC, Fn->getReturnType(), Fn->getAttributes(), Outs, *TLI,
100100
mf.getDataLayout());
101101
CanLowerReturn =
102-
TLI->CanLowerReturn(CC, *MF, Fn->isVarArg(), Outs, Fn->getContext());
102+
TLI->CanLowerReturn(CC, *MF, Fn->isVarArg(), Outs, Fn->getContext(), Fn->getReturnType());
103103

104104
// If this personality uses funclets, we need to do a bit more work.
105105
DenseMap<const AllocaInst *, TinyPtrVector<int *>> CatchObjects;

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11008,7 +11008,7 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const {
1100811008

1100911009
bool CanLowerReturn =
1101011010
this->CanLowerReturn(CLI.CallConv, CLI.DAG.getMachineFunction(),
11011-
CLI.IsVarArg, Outs, CLI.RetTy->getContext());
11011+
CLI.IsVarArg, Outs, CLI.RetTy->getContext(), CLI.RetTy);
1101211012

1101311013
SDValue DemoteStackSlot;
1101411014
int DemoteStackIdx = -100;

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9702,7 +9702,8 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
97029702

97039703
bool AArch64TargetLowering::CanLowerReturn(
97049704
CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg,
9705-
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context) const {
9705+
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
9706+
const Type *RetTy) const {
97069707
CCAssignFn *RetCC = CCAssignFnForReturn(CallConv);
97079708
SmallVector<CCValAssign, 16> RVLocs;
97089709
CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ class AArch64TargetLowering : public TargetLowering {
11031103
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
11041104
bool isVarArg,
11051105
const SmallVectorImpl<ISD::OutputArg> &Outs,
1106-
LLVMContext &Context) const override;
1106+
LLVMContext &Context, const Type *RetTy) const override;
11071107

11081108
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
11091109
const SmallVectorImpl<ISD::OutputArg> &Outs,

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3157,7 +3157,8 @@ SDValue SITargetLowering::LowerFormalArguments(
31573157
// possible in registers before passing on stack.
31583158
bool SITargetLowering::CanLowerReturn(
31593159
CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
3160-
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context) const {
3160+
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
3161+
const Type *RetTy) const {
31613162
// Replacing returns with sret/stack usage doesn't make sense for shaders.
31623163
// FIXME: Also sort of a workaround for custom vector splitting in LowerReturn
31633164
// for shaders. Vector types should be explicitly handled by CC.

llvm/lib/Target/AMDGPU/SIISelLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class SITargetLowering final : public AMDGPUTargetLowering {
392392
bool CanLowerReturn(CallingConv::ID CallConv,
393393
MachineFunction &MF, bool isVarArg,
394394
const SmallVectorImpl<ISD::OutputArg> &Outs,
395-
LLVMContext &Context) const override;
395+
LLVMContext &Context, const Type *RetTy) const override;
396396

397397
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
398398
const SmallVectorImpl<ISD::OutputArg> &Outs,

llvm/lib/Target/ARC/ARCISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ SDValue ARCTargetLowering::LowerCallArguments(
630630

631631
bool ARCTargetLowering::CanLowerReturn(
632632
CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
633-
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context) const {
633+
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
634+
const Type *RetTy) const {
634635
SmallVector<CCValAssign, 16> RVLocs;
635636
CCState CCInfo(CallConv, IsVarArg, MF, RVLocs, Context);
636637
if (!CCInfo.CheckReturn(Outs, RetCC_ARC))

llvm/lib/Target/ARC/ARCISelLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class ARCTargetLowering : public TargetLowering {
112112
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
113113
bool isVarArg,
114114
const SmallVectorImpl<ISD::OutputArg> &ArgsFlags,
115-
LLVMContext &Context) const override;
115+
LLVMContext &Context, const Type *RetTy) const override;
116116

117117
bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
118118
};

0 commit comments

Comments
 (0)