@@ -10200,22 +10200,6 @@ SDValue SystemZTargetLowering::lowerVECREDUCE_ADD(SDValue Op,
1020010200 DAG.getConstant (OpVT.getVectorNumElements () - 1 , DL, MVT::i32 ));
1020110201}
1020210202
10203- // Only consider a function fully internal as long as it has local linkage
10204- // and is not used in any other way than acting as the called function at
10205- // call sites.
10206- bool SystemZTargetLowering::isFullyInternal (const Function *Fn) const {
10207- if (!Fn->hasLocalLinkage ())
10208- return false ;
10209- for (const User *U : Fn->users ()) {
10210- if (auto *CB = dyn_cast<CallBase>(U)) {
10211- if (CB->getCalledFunction () != Fn)
10212- return false ;
10213- } else
10214- return false ;
10215- }
10216- return true ;
10217- }
10218-
1021910203static void printFunctionArgExts (const Function *F, raw_fd_ostream &OS) {
1022010204 FunctionType *FT = F->getFunctionType ();
1022110205 const AttributeList &Attrs = F->getAttributes ();
@@ -10234,6 +10218,16 @@ static void printFunctionArgExts(const Function *F, raw_fd_ostream &OS) {
1023410218 OS << " )\n " ;
1023510219}
1023610220
10221+ bool SystemZTargetLowering::isInternal (const Function *Fn) const {
10222+ std::map<const Function *, bool >::iterator Itr = IsInternalCache.find (Fn);
10223+ if (Itr == IsInternalCache.end ())
10224+ Itr = IsInternalCache
10225+ .insert (std::pair<const Function *, bool >(
10226+ Fn, (Fn->hasLocalLinkage () && !Fn->hasAddressTaken ())))
10227+ .first ;
10228+ return Itr->second ;
10229+ }
10230+
1023710231void SystemZTargetLowering::
1023810232verifyNarrowIntegerArgs_Call (const SmallVectorImpl<ISD::OutputArg> &Outs,
1023910233 const Function *F, SDValue Callee) const {
@@ -10246,8 +10240,8 @@ verifyNarrowIntegerArgs_Call(const SmallVectorImpl<ISD::OutputArg> &Outs,
1024610240 const Function *CalleeFn = nullptr ;
1024710241 if (auto *G = dyn_cast<GlobalAddressSDNode>(Callee))
1024810242 if ((CalleeFn = dyn_cast<Function>(G->getGlobal ())))
10249- IsInternal = isFullyInternal (CalleeFn);
10250- if (!verifyNarrowIntegerArgs (Outs, IsInternal )) {
10243+ IsInternal = isInternal (CalleeFn);
10244+ if (!IsInternal && ! verifyNarrowIntegerArgs (Outs)) {
1025110245 errs () << " ERROR: Missing extension attribute of passed "
1025210246 << " value in call to function:\n " << " Callee: " ;
1025310247 if (CalleeFn != nullptr )
@@ -10268,7 +10262,7 @@ verifyNarrowIntegerArgs_Ret(const SmallVectorImpl<ISD::OutputArg> &Outs,
1026810262 if (!EnableIntArgExtCheck)
1026910263 return ;
1027010264
10271- if (!verifyNarrowIntegerArgs (Outs, isFullyInternal (F) )) {
10265+ if (!isInternal (F) && ! verifyNarrowIntegerArgs (Outs )) {
1027210266 errs () << " ERROR: Missing extension attribute of returned "
1027310267 << " value from function:\n " ;
1027410268 printFunctionArgExts (F, errs ());
@@ -10278,10 +10272,9 @@ verifyNarrowIntegerArgs_Ret(const SmallVectorImpl<ISD::OutputArg> &Outs,
1027810272
1027910273// Verify that narrow integer arguments are extended as required by the ABI.
1028010274// Return false if an error is found.
10281- bool SystemZTargetLowering::
10282- verifyNarrowIntegerArgs (const SmallVectorImpl<ISD::OutputArg> &Outs,
10283- bool IsInternal) const {
10284- if (IsInternal || !Subtarget.isTargetELF ())
10275+ bool SystemZTargetLowering::verifyNarrowIntegerArgs (
10276+ const SmallVectorImpl<ISD::OutputArg> &Outs) const {
10277+ if (!Subtarget.isTargetELF ())
1028510278 return true ;
1028610279
1028710280 if (EnableIntArgExtCheck.getNumOccurrences ()) {
0 commit comments