Subzero: Don't contract an empty node that branches to itself.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4307
R=ascull@google.com
Review URL: https://codereview.chromium.org/1337113008 .
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index d57224b..58e74d4 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -748,8 +748,12 @@
else if (!I.isRedundantAssign())
return;
}
- Branch->setDeleted();
assert(OutEdges.size() == 1);
+ // Don't try to delete a self-loop.
+ if (OutEdges[0] == this)
+ return;
+
+ Branch->setDeleted();
CfgNode *Successor = OutEdges.front();
// Repoint all this node's in-edges to this node's successor, unless
// this node's successor is actually itself (in which case the