From b7fd53efc5da535eb97b772f3c95bfe74002dcf4 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Sun, 9 May 2021 19:38:20 -0700 Subject: [PATCH] Fix checker: after moving edge-moves to prior to last branch of block (for simpler semantics for library user), we can no longer check blockparams; but this is fine because they do not exist in post-regalloc code. --- src/checker.rs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/checker.rs b/src/checker.rs index 244a1e7..76b815a 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -549,18 +549,24 @@ impl<'a, F: Function> Checker<'a, F> { self.bb_insts.get_mut(&block).unwrap().push(checkinst); } - // Instruction itself. - let operands: Vec<_> = self.f.inst_operands(inst).iter().cloned().collect(); - let allocs: Vec<_> = out.inst_allocs(inst).iter().cloned().collect(); - let clobbers: Vec<_> = self.f.inst_clobbers(inst).iter().cloned().collect(); - let checkinst = CheckerInst::Op { - inst, - operands, - allocs, - clobbers, - }; - debug!("checker: adding inst {:?}", checkinst); - self.bb_insts.get_mut(&block).unwrap().push(checkinst); + // Skip if this is a branch: the blockparams do not + // exist in post-regalloc code, and the edge-moves + // have to be inserted before the branch rather than + // after. + if !self.f.is_branch(inst) { + // Instruction itself. + let operands: Vec<_> = self.f.inst_operands(inst).iter().cloned().collect(); + let allocs: Vec<_> = out.inst_allocs(inst).iter().cloned().collect(); + let clobbers: Vec<_> = self.f.inst_clobbers(inst).iter().cloned().collect(); + let checkinst = CheckerInst::Op { + inst, + operands, + allocs, + clobbers, + }; + debug!("checker: adding inst {:?}", checkinst); + self.bb_insts.get_mut(&block).unwrap().push(checkinst); + } // Any inserted edits after instruction. self.handle_edits(block, out, &mut insert_idx, ProgPoint::after(inst));