| Index: src/IceCfg.cpp
|
| diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
|
| index f7b1a8c6e0b99823230cf7263ba34521d5ada63f..7e915081700eec8a629c7d3f2fdbc61aba98a43c 100644
|
| --- a/src/IceCfg.cpp
|
| +++ b/src/IceCfg.cpp
|
| @@ -259,6 +259,8 @@ void Cfg::advancedPhiLowering() {
|
| // placed, while maintaining the same relative ordering among already
|
| // placed nodes.
|
| void Cfg::reorderNodes() {
|
| + // TODO(ascull): it would be nice if the switch tests were always followed
|
| + // by the default case to allow for fall through.
|
| typedef std::list<CfgNode *> PlacedList;
|
| PlacedList Placed; // Nodes with relative placement locked down
|
| PlacedList Unreachable; // Unreachable nodes
|
| @@ -271,20 +273,21 @@ void Cfg::reorderNodes() {
|
| // --PlaceIndex and assert() statements before moving to the next
|
| // node.
|
| do {
|
| - if (!Node->needsPlacement()) {
|
| - // Add to the end of the Placed list.
|
| - Placed.push_back(Node);
|
| - PlaceIndex[Node->getIndex()] = Placed.end();
|
| - continue;
|
| - }
|
| - Node->setNeedsPlacement(false);
|
| if (Node != getEntryNode() && Node->getInEdges().empty()) {
|
| // The node has essentially been deleted since it is not a
|
| // successor of any other node.
|
| Unreachable.push_back(Node);
|
| PlaceIndex[Node->getIndex()] = Unreachable.end();
|
| + Node->setNeedsPlacement(false);
|
| continue;
|
| }
|
| + if (!Node->needsPlacement()) {
|
| + // Add to the end of the Placed list.
|
| + Placed.push_back(Node);
|
| + PlaceIndex[Node->getIndex()] = Placed.end();
|
| + continue;
|
| + }
|
| + Node->setNeedsPlacement(false);
|
| // Assume for now that the unplaced node is from edge-splitting
|
| // and therefore has 1 in-edge and 1 out-edge (actually, possibly
|
| // more than 1 in-edge if the predecessor node was contracted).
|
| @@ -521,8 +524,7 @@ void Cfg::contractEmptyNodes() {
|
| void Cfg::doBranchOpt() {
|
| TimerMarker T(TimerStack::TT_doBranchOpt, this);
|
| for (auto I = Nodes.begin(), E = Nodes.end(); I != E; ++I) {
|
| - auto NextNode = I;
|
| - ++NextNode;
|
| + auto NextNode = I + 1;
|
| (*I)->doBranchOpt(NextNode == E ? nullptr : *NextNode);
|
| }
|
| }
|
|
|