Better verifier error for coinciding defs.

If a virtual register contains values that a defined at the same program
point, say so. Don't cryptically claim that one dominates the other.
This commit is contained in:
Jakob Stoklund Olesen
2017-12-14 17:04:16 -06:00
parent febe8e0e51
commit 66073eb26c

View File

@@ -3,7 +3,7 @@
use dbg::DisplayList;
use dominator_tree::DominatorTree;
use flowgraph::ControlFlowGraph;
use ir::Function;
use ir::{Function, ExpandedProgramPoint};
use regalloc::liveness::Liveness;
use regalloc::virtregs::VirtRegs;
use timing;
@@ -68,10 +68,21 @@ impl<'a> CssaVerifier<'a> {
};
// Check topological ordering with the previous values in the virtual register.
let def = self.func.dfg.value_def(val).into();
let def: ExpandedProgramPoint = self.func.dfg.value_def(val).into();
let def_ebb = self.func.layout.pp_ebb(def);
for &prev_val in &values[0..idx] {
let prev_def = self.func.dfg.value_def(prev_val);
let prev_def: ExpandedProgramPoint = self.func.dfg.value_def(prev_val).into();
if prev_def == def {
return err!(
val,
"Values {} and {} in {} = {} defined at the same program point",
prev_val,
val,
vreg,
DisplayList(values)
);
}
// Enforce topological ordering of defs in the virtual register.
if self.domtree.dominates(def, prev_def, &self.func.layout) {