Handle a half-full func.locations map.

If func.locations has not been properly resized to have an entry for all
values, we should just full in the default location for the missing
values instead of crashing.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-08 19:43:24 -08:00
parent 58756e5d34
commit bc1901b766

View File

@@ -186,7 +186,9 @@ fn write_instruction(w: &mut Write,
if !func.locations.is_empty() {
let regs = isa.register_info();
for r in func.dfg.inst_results(inst) {
write!(s, ",{}", func.locations[r].display(&regs))?
write!(s,
",{}",
func.locations.get(r).cloned().unwrap_or_default().display(&regs))?
}
}
write!(s, "]")?;