Index: src/IceCfgNode.cpp |
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp |
index d57224b9f14a2949e5aa5f04061114054eab42eb..58e74d484490943cc970bb7f14189124734543d0 100644 |
--- a/src/IceCfgNode.cpp |
+++ b/src/IceCfgNode.cpp |
@@ -748,8 +748,12 @@ void CfgNode::contractIfEmpty() { |
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 |