Fixed bug in verifier (#109)

* Fixed bug in verifier
Does not check variable def for unreachable codex

* Check reachability first + file test
This commit is contained in:
Denis Merigoux
2017-07-05 08:44:51 -07:00
committed by Jakob Stoklund Olesen
parent 8c60555409
commit f867ddbf0c
2 changed files with 27 additions and 2 deletions

View File

@@ -363,7 +363,8 @@ impl<'a> Verifier<'a> {
def_inst);
}
// Defining instruction dominates the instruction that uses the value.
if !self.domtree
if self.domtree.is_reachable(self.func.layout.pp_ebb(loc_inst)) &&
!self.domtree
.dominates(def_inst, loc_inst, &self.func.layout) {
return err!(loc_inst, "uses value from non-dominating {}", def_inst);
}
@@ -381,7 +382,8 @@ impl<'a> Verifier<'a> {
ebb);
}
// The defining EBB dominates the instruction using this value.
if !self.domtree.dominates(ebb, loc_inst, &self.func.layout) {
if self.domtree.is_reachable(ebb) &&
!self.domtree.dominates(ebb, loc_inst, &self.func.layout) {
return err!(loc_inst, "uses value arg from non-dominating {}", ebb);
}
}