[llvm] r237212 - [PlaceSafepoints] Followup to commit L237172
Philip Reames
listmail at philipreames.com
Tue May 12 16:39:23 PDT 2015
Author: reames
Date: Tue May 12 18:39:23 2015
New Revision: 237212
URL: http://llvm.org/viewvc/llvm-project?rev=237212&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp?rev=237212&r1=237211&r2=237212&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PlaceSafepoints.cpp Tue May 12 18:39:23 2015
@@ -606,13 +606,11 @@ bool PlaceSafepoints::runOnFunction(Func
PollLocations.end());
// Insert a poll at each point the analysis pass identified
- for (size_t i = 0; i < PollLocations.size(); i++) {
+ // The poll location must be the terminator of a loop latch block.
+ for (TerminatorInst *Term : PollLocations) {
// We are inserting a poll, the function is modified
modified = true;
-
- // The poll location must be the terminator of a loop latch block.
- TerminatorInst *Term = PollLocations[i];
-
+
std::vector<CallSite> ParsePoints;
if (SplitBackedge) {
// Split the backedge of the loop and insert the poll within that new
@@ -639,11 +637,8 @@ bool PlaceSafepoints::runOnFunction(Func
// date and use a more natural merged loop.
SetVector<BasicBlock *> SplitBackedges;
for (BasicBlock *Header : Headers) {
- BasicBlock *NewBB = SplitEdge(Term->getParent(), Header, nullptr);
- SplitBackedges.insert(NewBB);
- }
- DT.recalculate(F);
- for (BasicBlock *NewBB : SplitBackedges) {
+ BasicBlock *NewBB = SplitEdge(Term->getParent(), Header, &DT);
+
std::vector<CallSite> RuntimeCalls;
InsertSafepointPoll(DT, NewBB->getTerminator(), RuntimeCalls);
NumBackedgeSafepoints++;
More information about the llvm-commits
mailing list