@@ -10743,22 +10743,6 @@ SDValue SystemZTargetLowering::lowerVECREDUCE_ADD(SDValue Op,
10743
10743
DAG.getConstant (OpVT.getVectorNumElements () - 1 , DL, MVT::i32 ));
10744
10744
}
10745
10745
10746
- // Only consider a function fully internal as long as it has local linkage
10747
- // and is not used in any other way than acting as the called function at
10748
- // call sites.
10749
- bool SystemZTargetLowering::isFullyInternal (const Function *Fn) const {
10750
- if (!Fn->hasLocalLinkage ())
10751
- return false ;
10752
- for (const User *U : Fn->users ()) {
10753
- if (auto *CB = dyn_cast<CallBase>(U)) {
10754
- if (CB->getCalledFunction () != Fn)
10755
- return false ;
10756
- } else
10757
- return false ;
10758
- }
10759
- return true ;
10760
- }
10761
-
10762
10746
static void printFunctionArgExts (const Function *F, raw_fd_ostream &OS) {
10763
10747
FunctionType *FT = F->getFunctionType ();
10764
10748
const AttributeList &Attrs = F->getAttributes ();
@@ -10777,6 +10761,16 @@ static void printFunctionArgExts(const Function *F, raw_fd_ostream &OS) {
10777
10761
OS << " )\n " ;
10778
10762
}
10779
10763
10764
+ bool SystemZTargetLowering::isInternal (const Function *Fn) const {
10765
+ std::map<const Function *, bool >::iterator Itr = IsInternalCache.find (Fn);
10766
+ if (Itr == IsInternalCache.end ())
10767
+ Itr = IsInternalCache
10768
+ .insert (std::pair<const Function *, bool >(
10769
+ Fn, (Fn->hasLocalLinkage () && !Fn->hasAddressTaken ())))
10770
+ .first ;
10771
+ return Itr->second ;
10772
+ }
10773
+
10780
10774
void SystemZTargetLowering::
10781
10775
verifyNarrowIntegerArgs_Call (const SmallVectorImpl<ISD::OutputArg> &Outs,
10782
10776
const Function *F, SDValue Callee) const {
@@ -10789,8 +10783,8 @@ verifyNarrowIntegerArgs_Call(const SmallVectorImpl<ISD::OutputArg> &Outs,
10789
10783
const Function *CalleeFn = nullptr ;
10790
10784
if (auto *G = dyn_cast<GlobalAddressSDNode>(Callee))
10791
10785
if ((CalleeFn = dyn_cast<Function>(G->getGlobal ())))
10792
- IsInternal = isFullyInternal (CalleeFn);
10793
- if (!verifyNarrowIntegerArgs (Outs, IsInternal )) {
10786
+ IsInternal = isInternal (CalleeFn);
10787
+ if (!IsInternal && ! verifyNarrowIntegerArgs (Outs)) {
10794
10788
errs () << " ERROR: Missing extension attribute of passed "
10795
10789
<< " value in call to function:\n " << " Callee: " ;
10796
10790
if (CalleeFn != nullptr )
@@ -10811,7 +10805,7 @@ verifyNarrowIntegerArgs_Ret(const SmallVectorImpl<ISD::OutputArg> &Outs,
10811
10805
if (!EnableIntArgExtCheck)
10812
10806
return ;
10813
10807
10814
- if (!verifyNarrowIntegerArgs (Outs, isFullyInternal (F) )) {
10808
+ if (!isInternal (F) && ! verifyNarrowIntegerArgs (Outs )) {
10815
10809
errs () << " ERROR: Missing extension attribute of returned "
10816
10810
<< " value from function:\n " ;
10817
10811
printFunctionArgExts (F, errs ());
@@ -10821,10 +10815,9 @@ verifyNarrowIntegerArgs_Ret(const SmallVectorImpl<ISD::OutputArg> &Outs,
10821
10815
10822
10816
// Verify that narrow integer arguments are extended as required by the ABI.
10823
10817
// Return false if an error is found.
10824
- bool SystemZTargetLowering::
10825
- verifyNarrowIntegerArgs (const SmallVectorImpl<ISD::OutputArg> &Outs,
10826
- bool IsInternal) const {
10827
- if (IsInternal || !Subtarget.isTargetELF ())
10818
+ bool SystemZTargetLowering::verifyNarrowIntegerArgs (
10819
+ const SmallVectorImpl<ISD::OutputArg> &Outs) const {
10820
+ if (!Subtarget.isTargetELF ())
10828
10821
return true ;
10829
10822
10830
10823
if (EnableIntArgExtCheck.getNumOccurrences ()) {
0 commit comments