@@ -320,7 +320,8 @@ bool AA::getPotentialCopiesOfStoredValue(
320
320
321
321
Value &Ptr = *SI.getPointerOperand ();
322
322
SmallVector<Value *, 8 > Objects;
323
- if (!AA::getAssumedUnderlyingObjects (A, Ptr , Objects, QueryingAA, &SI)) {
323
+ if (!AA::getAssumedUnderlyingObjects (A, Ptr , Objects, QueryingAA, &SI,
324
+ UsedAssumedInformation)) {
324
325
LLVM_DEBUG (
325
326
dbgs () << " Underlying objects stored into could not be determined\n " ;);
326
327
return false ;
@@ -514,10 +515,10 @@ isPotentiallyReachable(Attributor &A, const Instruction &FromI,
514
515
return true ;
515
516
};
516
517
517
- bool AllCallSitesKnown ;
518
+ bool UsedAssumedInformation = false ;
518
519
Result = !A.checkForAllCallSites (CheckCallSite, *FromFn,
519
520
/* RequireAllCallSites */ true ,
520
- &QueryingAA, AllCallSitesKnown );
521
+ &QueryingAA, UsedAssumedInformation );
521
522
if (Result) {
522
523
LLVM_DEBUG (dbgs () << " [AA] stepping back to call sites from " << *CurFromI
523
524
<< " in @" << FromFn->getName ()
@@ -1277,7 +1278,7 @@ bool Attributor::checkForAllUses(
1277
1278
bool Attributor::checkForAllCallSites (function_ref<bool (AbstractCallSite)> Pred,
1278
1279
const AbstractAttribute &QueryingAA,
1279
1280
bool RequireAllCallSites,
1280
- bool &AllCallSitesKnown ) {
1281
+ bool &UsedAssumedInformation ) {
1281
1282
// We can try to determine information from
1282
1283
// the call sites. However, this is only possible all call sites are known,
1283
1284
// hence the function has internal linkage.
@@ -1286,31 +1287,26 @@ bool Attributor::checkForAllCallSites(function_ref<bool(AbstractCallSite)> Pred,
1286
1287
if (!AssociatedFunction) {
1287
1288
LLVM_DEBUG (dbgs () << " [Attributor] No function associated with " << IRP
1288
1289
<< " \n " );
1289
- AllCallSitesKnown = false ;
1290
1290
return false ;
1291
1291
}
1292
1292
1293
1293
return checkForAllCallSites (Pred, *AssociatedFunction, RequireAllCallSites,
1294
- &QueryingAA, AllCallSitesKnown );
1294
+ &QueryingAA, UsedAssumedInformation );
1295
1295
}
1296
1296
1297
1297
bool Attributor::checkForAllCallSites (function_ref<bool (AbstractCallSite)> Pred,
1298
1298
const Function &Fn,
1299
1299
bool RequireAllCallSites,
1300
1300
const AbstractAttribute *QueryingAA,
1301
- bool &AllCallSitesKnown ) {
1301
+ bool &UsedAssumedInformation ) {
1302
1302
if (RequireAllCallSites && !Fn.hasLocalLinkage ()) {
1303
1303
LLVM_DEBUG (
1304
1304
dbgs ()
1305
1305
<< " [Attributor] Function " << Fn.getName ()
1306
1306
<< " has no internal linkage, hence not all call sites are known\n " );
1307
- AllCallSitesKnown = false ;
1308
1307
return false ;
1309
1308
}
1310
1309
1311
- // If we do not require all call sites we might not see all.
1312
- AllCallSitesKnown = RequireAllCallSites;
1313
-
1314
1310
SmallVector<const Use *, 8 > Uses (make_pointer_range (Fn.uses ()));
1315
1311
for (unsigned u = 0 ; u < Uses.size (); ++u) {
1316
1312
const Use &U = *Uses[u];
@@ -1322,7 +1318,6 @@ bool Attributor::checkForAllCallSites(function_ref<bool(AbstractCallSite)> Pred,
1322
1318
dbgs () << " [Attributor] Check use: " << *U << " in " << *U.getUser ()
1323
1319
<< " \n " ;
1324
1320
});
1325
- bool UsedAssumedInformation = false ;
1326
1321
if (isAssumedDead (U, QueryingAA, nullptr , UsedAssumedInformation,
1327
1322
/* CheckBBLivenessOnly */ true )) {
1328
1323
LLVM_DEBUG (dbgs () << " [Attributor] Dead use, skip!\n " );
@@ -1795,15 +1790,15 @@ void Attributor::identifyDeadInternalFunctions() {
1795
1790
if (!F)
1796
1791
continue ;
1797
1792
1798
- bool AllCallSitesKnown ;
1793
+ bool UsedAssumedInformation = false ;
1799
1794
if (checkForAllCallSites (
1800
1795
[&](AbstractCallSite ACS) {
1801
1796
Function *Callee = ACS.getInstruction ()->getFunction ();
1802
1797
return ToBeDeletedFunctions.count (Callee) ||
1803
1798
(Functions.count (Callee) && Callee->hasLocalLinkage () &&
1804
1799
!LiveInternalFns.count (Callee));
1805
1800
},
1806
- *F, true , nullptr , AllCallSitesKnown )) {
1801
+ *F, true , nullptr , UsedAssumedInformation )) {
1807
1802
continue ;
1808
1803
}
1809
1804
@@ -2290,9 +2285,9 @@ bool Attributor::isValidFunctionSignatureRewrite(
2290
2285
}
2291
2286
2292
2287
// Avoid callbacks for now.
2293
- bool AllCallSitesKnown ;
2288
+ bool UsedAssumedInformation = false ;
2294
2289
if (!checkForAllCallSites (CallSiteCanBeChanged, *Fn, true , nullptr ,
2295
- AllCallSitesKnown )) {
2290
+ UsedAssumedInformation )) {
2296
2291
LLVM_DEBUG (dbgs () << " [Attributor] Cannot rewrite all call sites\n " );
2297
2292
return false ;
2298
2293
}
@@ -2305,7 +2300,6 @@ bool Attributor::isValidFunctionSignatureRewrite(
2305
2300
2306
2301
// Forbid must-tail calls for now.
2307
2302
// TODO:
2308
- bool UsedAssumedInformation = false ;
2309
2303
auto &OpcodeInstMap = InfoCache.getOpcodeInstMapForFunction (*Fn);
2310
2304
if (!checkForAllInstructionsImpl (nullptr , OpcodeInstMap, InstPred, nullptr ,
2311
2305
nullptr , {Instruction::Call},
@@ -2514,9 +2508,9 @@ ChangeStatus Attributor::rewriteFunctionSignatures(
2514
2508
};
2515
2509
2516
2510
// Use the CallSiteReplacementCreator to create replacement call sites.
2517
- bool AllCallSitesKnown ;
2511
+ bool UsedAssumedInformation = false ;
2518
2512
bool Success = checkForAllCallSites (CallSiteReplacementCreator, *OldFn,
2519
- true , nullptr , AllCallSitesKnown );
2513
+ true , nullptr , UsedAssumedInformation );
2520
2514
(void )Success;
2521
2515
assert (Success && " Assumed call site replacement to succeed!" );
2522
2516
0 commit comments