@@ -1231,10 +1231,8 @@ struct InformationCache {
1231
1231
InformationCache (const Module &M, AnalysisGetter &AG,
1232
1232
BumpPtrAllocator &Allocator, SetVector<Function *> *CGSCC,
1233
1233
bool UseExplorer = true )
1234
- : DL(M.getDataLayout()), Allocator(Allocator), AG(AG),
1234
+ : CGSCC(CGSCC), DL(M.getDataLayout()), Allocator(Allocator), AG(AG),
1235
1235
TargetTriple (M.getTargetTriple()) {
1236
- if (CGSCC)
1237
- initializeModuleSlice (*CGSCC);
1238
1236
if (UseExplorer)
1239
1237
Explorer = new (Allocator) MustBeExecutedContextExplorer (
1240
1238
/* ExploreInterBlock */ true , /* ExploreCFGForward */ true ,
@@ -1286,46 +1284,8 @@ struct InformationCache {
1286
1284
}
1287
1285
}
1288
1286
1289
- // / Initialize the ModuleSlice member based on \p SCC. ModuleSlices contains
1290
- // / (a subset of) all functions that we can look at during this SCC traversal.
1291
- // / This includes functions (transitively) called from the SCC and the
1292
- // / (transitive) callers of SCC functions. We also can look at a function if
1293
- // / there is a "reference edge", i.a., if the function somehow uses (!=calls)
1294
- // / a function in the SCC or a caller of a function in the SCC.
1295
- void initializeModuleSlice (SetVector<Function *> &SCC) {
1296
- ModuleSlice.insert (SCC.begin (), SCC.end ());
1297
-
1298
- SmallPtrSet<Function *, 16 > Seen;
1299
- SmallVector<Function *, 16 > Worklist (SCC.begin (), SCC.end ());
1300
- while (!Worklist.empty ()) {
1301
- Function *F = Worklist.pop_back_val ();
1302
- ModuleSlice.insert (F);
1303
-
1304
- for (Instruction &I : instructions (*F))
1305
- if (auto *CB = dyn_cast<CallBase>(&I))
1306
- if (auto *Callee =
1307
- dyn_cast_if_present<Function>(CB->getCalledOperand ()))
1308
- if (Seen.insert (Callee).second )
1309
- Worklist.push_back (Callee);
1310
- }
1311
-
1312
- Seen.clear ();
1313
- Worklist.append (SCC.begin (), SCC.end ());
1314
- while (!Worklist.empty ()) {
1315
- Function *F = Worklist.pop_back_val ();
1316
- ModuleSlice.insert (F);
1317
-
1318
- // Traverse all transitive uses.
1319
- foreachUse (*F, [&](Use &U) {
1320
- if (auto *UsrI = dyn_cast<Instruction>(U.getUser ()))
1321
- if (Seen.insert (UsrI->getFunction ()).second )
1322
- Worklist.push_back (UsrI->getFunction ());
1323
- });
1324
- }
1325
- }
1326
-
1327
- // / The slice of the module we are allowed to look at.
1328
- SmallPtrSet<Function *, 8 > ModuleSlice;
1287
+ // / The CG-SCC the pass is run on, or nullptr if it is a module pass.
1288
+ const SetVector<Function *> *const CGSCC = nullptr ;
1329
1289
1330
1290
// / A vector type to hold instructions.
1331
1291
using InstructionVectorTy = SmallVector<Instruction *, 8 >;
@@ -1391,11 +1351,6 @@ struct InformationCache {
1391
1351
return UniqueBES;
1392
1352
}
1393
1353
1394
- // / Check whether \p F is part of module slice.
1395
- bool isInModuleSlice (const Function &F) {
1396
- return ModuleSlice.empty () || ModuleSlice.count (const_cast <Function *>(&F));
1397
- }
1398
-
1399
1354
// / Return true if the stack (llvm::Alloca) can be accessed by other threads.
1400
1355
bool stackIsAccessibleByOtherThreads () { return !targetIsGPU (); }
1401
1356
0 commit comments