@@ -51,7 +51,7 @@ static constexpr auto TAG = "[" DEBUG_TYPE "]";
51
51
namespace {
52
52
struct OpenMPOpt {
53
53
54
- OpenMPOpt (SmallPtrSetImpl <Function *> &SCC,
54
+ OpenMPOpt (SmallVectorImpl <Function *> &SCC,
55
55
SmallPtrSetImpl<Function *> &ModuleSlice,
56
56
CallGraphUpdater &CGUpdater)
57
57
: M(*(*SCC.begin())->getParent ()), SCC(SCC), ModuleSlice(ModuleSlice),
@@ -475,7 +475,7 @@ struct OpenMPOpt {
475
475
Module &M;
476
476
477
477
// / The SCC we are operating on.
478
- SmallPtrSetImpl <Function *> &SCC;
478
+ SmallVectorImpl <Function *> &SCC;
479
479
480
480
// / The slice of the module we are allowed to look at.
481
481
SmallPtrSetImpl<Function *> &ModuleSlice;
@@ -503,17 +503,20 @@ PreservedAnalyses OpenMPOptPass::run(LazyCallGraph::SCC &C,
503
503
if (DisableOpenMPOptimizations)
504
504
return PreservedAnalyses::all ();
505
505
506
- SmallPtrSet<Function *, 16 > SCC;
507
- for (LazyCallGraph::Node &N : C)
508
- SCC.insert (&N.getFunction ());
506
+ SmallPtrSet<Function *, 16 > ModuleSlice;
507
+ SmallVector<Function *, 16 > SCC;
508
+ for (LazyCallGraph::Node &N : C) {
509
+ SCC.push_back (&N.getFunction ());
510
+ ModuleSlice.insert (SCC.back ());
511
+ }
509
512
510
513
if (SCC.empty ())
511
514
return PreservedAnalyses::all ();
512
515
513
516
CallGraphUpdater CGUpdater;
514
517
CGUpdater.initialize (CG, C, AM, UR);
515
518
// TODO: Compute the module slice we are allowed to look at.
516
- OpenMPOpt OMPOpt (SCC, SCC , CGUpdater);
519
+ OpenMPOpt OMPOpt (SCC, ModuleSlice , CGUpdater);
517
520
bool Changed = OMPOpt.run ();
518
521
(void )Changed;
519
522
return PreservedAnalyses::all ();
@@ -546,11 +549,14 @@ struct OpenMPOptLegacyPass : public CallGraphSCCPass {
546
549
if (DisableOpenMPOptimizations || skipSCC (CGSCC))
547
550
return false ;
548
551
549
- SmallPtrSet<Function *, 16 > SCC;
552
+ SmallPtrSet<Function *, 16 > ModuleSlice;
553
+ SmallVector<Function *, 16 > SCC;
550
554
for (CallGraphNode *CGN : CGSCC)
551
555
if (Function *Fn = CGN->getFunction ())
552
- if (!Fn->isDeclaration ())
553
- SCC.insert (Fn);
556
+ if (!Fn->isDeclaration ()) {
557
+ SCC.push_back (Fn);
558
+ ModuleSlice.insert (Fn);
559
+ }
554
560
555
561
if (SCC.empty ())
556
562
return false ;
@@ -559,7 +565,7 @@ struct OpenMPOptLegacyPass : public CallGraphSCCPass {
559
565
CGUpdater.initialize (CG, CGSCC);
560
566
561
567
// TODO: Compute the module slice we are allowed to look at.
562
- OpenMPOpt OMPOpt (SCC, SCC , CGUpdater);
568
+ OpenMPOpt OMPOpt (SCC, ModuleSlice , CGUpdater);
563
569
return OMPOpt.run ();
564
570
}
565
571
0 commit comments