Fix the original block for block params in egraphs (#5960)

This fixes an issue where block params were always listed as being
members of the current block in egraphs, even when the block param was
actually defined in a separate block. This then enables instructions
which depend on these parameters to get hoisted up out of inner loops at
least to the block that defined the argument.

Closes #5957
This commit is contained in:
Alex Crichton
2023-03-07 17:58:03 -06:00
committed by GitHub
parent d9cdbef920
commit afde4ea4e3
2 changed files with 46 additions and 2 deletions

View File

@@ -330,14 +330,14 @@ impl<'a> Elaborator<'a> {
);
(inst, result_idx)
}
ValueDef::Param(_, _) => {
ValueDef::Param(in_block, _) => {
// We don't need to do anything to compute
// this value; just push its result on the
// result stack (blockparams are already
// available).
trace!(" -> value {} is a blockparam", best_value);
self.elab_result_stack.push(ElaboratedValue {
in_block: self.cur_block,
in_block,
value: best_value,
});
continue;