+
+ // Check that a definition dominates all of its uses.
+ // FIXME: This should use dominator set information, instead of this local
+ // hack that we have now.
+ //
+ for (User::use_iterator UI = I.use_begin(), UE = I.use_end();
+ UI != UE; ++UI) {
+ Instruction *I2 = cast<Instruction>(*UI);
+ // Same basic block?
+ if (I.getParent() == I2->getParent() && !isa<PHINode>(I2)) {
+ // Make sure the instruction is not before the current instruction...
+ for (Instruction *Test = I.getPrev(); Test != 0; Test = Test->getPrev())
+ Assert2(Test != I2, "Definition of value does not dominate a use!",
+ &I, I2);
+ }
+ }
+