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/IceCfgNode.cpp

Issue 1337113008: Subzero: Don't contract an empty node that branches to itself. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a test Created 5 years, 3 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 | tests_lit/llvm2ice_tests/contract.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/contract.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698