@@ -320,7 +320,8 @@ bool AA::getPotentialCopiesOfStoredValue(
320320
321321 Value &Ptr = *SI.getPointerOperand ();
322322 SmallVector<Value *, 8 > Objects;
323- if (!AA::getAssumedUnderlyingObjects (A, Ptr, Objects, QueryingAA, &SI)) {
323+ if (!AA::getAssumedUnderlyingObjects (A, Ptr, Objects, QueryingAA, &SI,
324+ UsedAssumedInformation)) {
324325 LLVM_DEBUG (
325326 dbgs () << " Underlying objects stored into could not be determined\n " ;);
326327 return false ;
@@ -514,10 +515,10 @@ isPotentiallyReachable(Attributor &A, const Instruction &FromI,
514515 return true ;
515516 };
516517
517- bool AllCallSitesKnown ;
518+ bool UsedAssumedInformation = false ;
518519 Result = !A.checkForAllCallSites (CheckCallSite, *FromFn,
519520 /* RequireAllCallSites */ true ,
520- &QueryingAA, AllCallSitesKnown );
521+ &QueryingAA, UsedAssumedInformation );
521522 if (Result) {
522523 LLVM_DEBUG (dbgs () << " [AA] stepping back to call sites from " << *CurFromI
523524 << " in @" << FromFn->getName ()
@@ -1277,7 +1278,7 @@ bool Attributor::checkForAllUses(
12771278bool Attributor::checkForAllCallSites (function_ref<bool (AbstractCallSite)> Pred,
12781279 const AbstractAttribute &QueryingAA,
12791280 bool RequireAllCallSites,
1280- bool &AllCallSitesKnown ) {
1281+ bool &UsedAssumedInformation ) {
12811282 // We can try to determine information from
12821283 // the call sites. However, this is only possible all call sites are known,
12831284 // hence the function has internal linkage.
@@ -1286,31 +1287,26 @@ bool Attributor::checkForAllCallSites(function_ref<bool(AbstractCallSite)> Pred,
12861287 if (!AssociatedFunction) {
12871288 LLVM_DEBUG (dbgs () << " [Attributor] No function associated with " << IRP
12881289 << " \n " );
1289- AllCallSitesKnown = false ;
12901290 return false ;
12911291 }
12921292
12931293 return checkForAllCallSites (Pred, *AssociatedFunction, RequireAllCallSites,
1294- &QueryingAA, AllCallSitesKnown );
1294+ &QueryingAA, UsedAssumedInformation );
12951295}
12961296
12971297bool Attributor::checkForAllCallSites (function_ref<bool (AbstractCallSite)> Pred,
12981298 const Function &Fn,
12991299 bool RequireAllCallSites,
13001300 const AbstractAttribute *QueryingAA,
1301- bool &AllCallSitesKnown ) {
1301+ bool &UsedAssumedInformation ) {
13021302 if (RequireAllCallSites && !Fn.hasLocalLinkage ()) {
13031303 LLVM_DEBUG (
13041304 dbgs ()
13051305 << " [Attributor] Function " << Fn.getName ()
13061306 << " has no internal linkage, hence not all call sites are known\n " );
1307- AllCallSitesKnown = false ;
13081307 return false ;
13091308 }
13101309
1311- // If we do not require all call sites we might not see all.
1312- AllCallSitesKnown = RequireAllCallSites;
1313-
13141310 SmallVector<const Use *, 8 > Uses (make_pointer_range (Fn.uses ()));
13151311 for (unsigned u = 0 ; u < Uses.size (); ++u) {
13161312 const Use &U = *Uses[u];
@@ -1322,7 +1318,6 @@ bool Attributor::checkForAllCallSites(function_ref<bool(AbstractCallSite)> Pred,
13221318 dbgs () << " [Attributor] Check use: " << *U << " in " << *U.getUser ()
13231319 << " \n " ;
13241320 });
1325- bool UsedAssumedInformation = false ;
13261321 if (isAssumedDead (U, QueryingAA, nullptr , UsedAssumedInformation,
13271322 /* CheckBBLivenessOnly */ true )) {
13281323 LLVM_DEBUG (dbgs () << " [Attributor] Dead use, skip!\n " );
@@ -1795,15 +1790,15 @@ void Attributor::identifyDeadInternalFunctions() {
17951790 if (!F)
17961791 continue ;
17971792
1798- bool AllCallSitesKnown ;
1793+ bool UsedAssumedInformation = false ;
17991794 if (checkForAllCallSites (
18001795 [&](AbstractCallSite ACS) {
18011796 Function *Callee = ACS.getInstruction ()->getFunction ();
18021797 return ToBeDeletedFunctions.count (Callee) ||
18031798 (Functions.count (Callee) && Callee->hasLocalLinkage () &&
18041799 !LiveInternalFns.count (Callee));
18051800 },
1806- *F, true , nullptr , AllCallSitesKnown )) {
1801+ *F, true , nullptr , UsedAssumedInformation )) {
18071802 continue ;
18081803 }
18091804
@@ -2290,9 +2285,9 @@ bool Attributor::isValidFunctionSignatureRewrite(
22902285 }
22912286
22922287 // Avoid callbacks for now.
2293- bool AllCallSitesKnown ;
2288+ bool UsedAssumedInformation = false ;
22942289 if (!checkForAllCallSites (CallSiteCanBeChanged, *Fn, true , nullptr ,
2295- AllCallSitesKnown )) {
2290+ UsedAssumedInformation )) {
22962291 LLVM_DEBUG (dbgs () << " [Attributor] Cannot rewrite all call sites\n " );
22972292 return false ;
22982293 }
@@ -2305,7 +2300,6 @@ bool Attributor::isValidFunctionSignatureRewrite(
23052300
23062301 // Forbid must-tail calls for now.
23072302 // TODO:
2308- bool UsedAssumedInformation = false ;
23092303 auto &OpcodeInstMap = InfoCache.getOpcodeInstMapForFunction (*Fn);
23102304 if (!checkForAllInstructionsImpl (nullptr , OpcodeInstMap, InstPred, nullptr ,
23112305 nullptr , {Instruction::Call},
@@ -2514,9 +2508,9 @@ ChangeStatus Attributor::rewriteFunctionSignatures(
25142508 };
25152509
25162510 // Use the CallSiteReplacementCreator to create replacement call sites.
2517- bool AllCallSitesKnown ;
2511+ bool UsedAssumedInformation = false ;
25182512 bool Success = checkForAllCallSites (CallSiteReplacementCreator, *OldFn,
2519- true , nullptr , AllCallSitesKnown );
2513+ true , nullptr , UsedAssumedInformation );
25202514 (void )Success;
25212515 assert (Success && " Assumed call site replacement to succeed!" );
25222516
0 commit comments