File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -645,13 +645,22 @@ void OmpSsRegionAnalysisPass::getOmpSsFunctionInfo(
645
645
}
646
646
}
647
647
648
+ std::unique_ptr<std::vector<Instruction *>> StackCopy;
649
+
648
650
for (auto It = succ_begin (BB); It != succ_end (BB); ++It) {
649
651
if (!Visited.count (*It)) {
650
652
Worklist.push_back (*It);
651
653
Visited.insert (*It);
652
654
// Forward Stack, since we are setting visited here
653
655
// we do this only once per BB
654
- BBTaskStacks[*It].append (Stack.begin (), Stack.end ());
656
+ if (!StackCopy) {
657
+ // We need to copy Stacki, otherwise &Stack as an iterator would be
658
+ // invalidated after BBTaskStacks[*It].
659
+ StackCopy.reset (
660
+ new std::vector<Instruction *>(Stack.begin (), Stack.end ()));
661
+ }
662
+
663
+ BBTaskStacks[*It].append (StackCopy->begin (), StackCopy->end ());
655
664
}
656
665
}
657
666
}
You can’t perform that action at this time.
0 commit comments