Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: src/IceCfg.cpp

Issue 1246173003: Remove jumps over empty blocks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Refactor to variable Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceCfgNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « no previous file | src/IceCfgNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698