Skip to content

Commit 89fe570

Browse files
committed
[PlaceSafepoints] Followup to commit L237172
Responding to review feedback from http://reviews.llvm.org/D9585 1) Remove a variable shadow by converting the outer loop to a range for loop. We never really used the 'i' variable which was being shadowed. 2) Reduce DominatorTree recalculations by passing the DT to SplitEdge. llvm-svn: 237212
1 parent ee13fbe commit 89fe570

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -606,13 +606,11 @@ bool PlaceSafepoints::runOnFunction(Function &F) {
606606
PollLocations.end());
607607

608608
// Insert a poll at each point the analysis pass identified
609-
for (size_t i = 0; i < PollLocations.size(); i++) {
609+
// The poll location must be the terminator of a loop latch block.
610+
for (TerminatorInst *Term : PollLocations) {
610611
// We are inserting a poll, the function is modified
611612
modified = true;
612-
613-
// The poll location must be the terminator of a loop latch block.
614-
TerminatorInst *Term = PollLocations[i];
615-
613+
616614
std::vector<CallSite> ParsePoints;
617615
if (SplitBackedge) {
618616
// Split the backedge of the loop and insert the poll within that new
@@ -639,11 +637,8 @@ bool PlaceSafepoints::runOnFunction(Function &F) {
639637
// date and use a more natural merged loop.
640638
SetVector<BasicBlock *> SplitBackedges;
641639
for (BasicBlock *Header : Headers) {
642-
BasicBlock *NewBB = SplitEdge(Term->getParent(), Header, nullptr);
643-
SplitBackedges.insert(NewBB);
644-
}
645-
DT.recalculate(F);
646-
for (BasicBlock *NewBB : SplitBackedges) {
640+
BasicBlock *NewBB = SplitEdge(Term->getParent(), Header, &DT);
641+
647642
std::vector<CallSite> RuntimeCalls;
648643
InsertSafepointPoll(DT, NewBB->getTerminator(), RuntimeCalls);
649644
NumBackedgeSafepoints++;

0 commit comments

Comments
 (0)