Subzero: Validate phi instructions after CFG construction.
It checks that each phi label corresponds to an incoming edge, and that each incoming edge has a corresponding phi label.
It does not check that duplicate incoming edges get the same phi value.
Performance impact is minimal (~0.2%) despite the O(N^2) implementation.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4304
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1351433002 .
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 57f216f..ed60abb 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -232,6 +232,10 @@
}
}
Nodes.resize(Dest);
+
+ TimerMarker T(TimerStack::TT_phiValidation, this);
+ for (CfgNode *Node : Nodes)
+ Node->validatePhis();
}
void Cfg::renumberInstructions() {