@@ -1657,31 +1657,15 @@ LowerUnalignedLoadRetParam(SelectionDAG &DAG, SDValue &Chain, uint64_t Offset,
1657
1657
return RetVal;
1658
1658
}
1659
1659
1660
- static bool shouldConvertToIndirectCall (bool IsVarArg, unsigned ParamCount,
1661
- NVPTXTargetLowering::ArgListTy &Args,
1662
- const CallBase *CB,
1663
- GlobalAddressSDNode *Func) {
1660
+ static bool shouldConvertToIndirectCall (const CallBase *CB,
1661
+ const GlobalAddressSDNode *Func) {
1664
1662
if (!Func)
1665
1663
return false ;
1666
1664
auto *CalleeFunc = dyn_cast<Function>(Func->getGlobal ());
1667
1665
if (!CalleeFunc)
1668
1666
return false ;
1669
1667
1670
- auto ActualReturnType = CalleeFunc->getReturnType ();
1671
- if (CB->getType () != ActualReturnType)
1672
- return true ;
1673
-
1674
- if (IsVarArg)
1675
- return false ;
1676
-
1677
- auto ActualNumParams = CalleeFunc->getFunctionType ()->getNumParams ();
1678
- if (ParamCount != ActualNumParams)
1679
- return true ;
1680
- for (const Argument &I : CalleeFunc->args ())
1681
- if (I.getType () != Args[I.getArgNo ()].Ty )
1682
- return true ;
1683
-
1684
- return false ;
1668
+ return CB->getFunctionType () != CalleeFunc->getFunctionType ();
1685
1669
}
1686
1670
1687
1671
SDValue NVPTXTargetLowering::LowerCall (TargetLowering::CallLoweringInfo &CLI,
@@ -1998,11 +1982,9 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
1998
1982
VADeclareParam->getVTList (), DeclareParamOps);
1999
1983
}
2000
1984
2001
- // If the param count, type of any param, or return type of the callsite
2002
- // mismatches with that of the function signature, convert the callsite to an
2003
- // indirect call.
2004
- bool ConvertToIndirectCall =
2005
- shouldConvertToIndirectCall (CLI.IsVarArg , ParamCount, Args, CB, Func);
1985
+ // If the type of the callsite does not match that of the function, convert
1986
+ // the callsite to an indirect call.
1987
+ bool ConvertToIndirectCall = shouldConvertToIndirectCall (CB, Func);
2006
1988
2007
1989
// Both indirect calls and libcalls have nullptr Func. In order to distinguish
2008
1990
// between them we must rely on the call site value which is valid for
0 commit comments