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

Unified Diff: lib/compiler/implementation/ssa/validate.dart

Issue 10454049: Validate that all instructions dominate their inputs. And fix a bug where that did not happen. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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
Index: lib/compiler/implementation/ssa/validate.dart
===================================================================
--- lib/compiler/implementation/ssa/validate.dart (revision 8084)
+++ lib/compiler/implementation/ssa/validate.dart (working copy)
@@ -82,6 +82,28 @@
if (!isValid) return;
block.forEachPhi(visitInstruction);
+
+ // Make sure the parameters of a phi are dominating the
+ // corresponding predecessor block.
Lasse Reichstein Nielsen 2012/05/30 09:35:14 We usually use "dominating" about blocks, not inst
ngeoffray 2012/05/30 10:19:07 Done.
+ block.forEachPhi((HPhi phi) {
+ for (int i = 0; i < phi.inputs.length; i++) {
+ HInstruction input = phi.inputs[i];
+ if (!input.block.dominates(block.predecessors[i])) {
+ markInvalid("Definition does not dominate use");
+ }
+ }
+ });
+
+ // Make sure the inputs of an instruction dominate the
+ // instruction.
+ block.forEachInstruction((HInstruction instruction) {
+ for (HInstruction input in instruction.inputs) {
Lasse Reichstein Nielsen 2012/05/30 09:35:14 This is an un-pretty combination of functional for
ngeoffray 2012/05/30 10:19:07 As discussed, it doesn't look un-pretty to me, as
+ if (!input.block.dominates(block)) {
+ markInvalid("Definition does not dominate use");
+ }
+ }
+ });
+
super.visitBasicBlock(block);
}

Powered by Google App Engine
This is Rietveld 408576698