Make sure to call find() on basic block arguments
This ensures basic block arguments keep instructions alive, etc.
This commit is contained in:
parent
b970ff1850
commit
0c44e5ab5e
Notes:
git
2025-04-29 18:01:48 +00:00
@ -744,11 +744,21 @@ impl Function {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
macro_rules! find_branch_edge {
|
||||||
|
( $edge:ident ) => {
|
||||||
|
{
|
||||||
|
BranchEdge {
|
||||||
|
target: $edge.target,
|
||||||
|
args: $edge.args.iter().map(|x| self.union_find.find_const(*x)).collect(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
let insn_id = self.union_find.find_const(insn_id);
|
let insn_id = self.union_find.find_const(insn_id);
|
||||||
use Insn::*;
|
use Insn::*;
|
||||||
match &self.insns[insn_id.0] {
|
match &self.insns[insn_id.0] {
|
||||||
result@(PutSelf | Const {..} | Param {..} | NewArray {..} | GetConstantPath {..}
|
result@(PutSelf | Const {..} | Param {..} | NewArray {..} | GetConstantPath {..}
|
||||||
| Jump(_) | PatchPoint {..}) => result.clone(),
|
| PatchPoint {..}) => result.clone(),
|
||||||
Snapshot { state: FrameState { iseq, insn_idx, pc, stack, locals } } =>
|
Snapshot { state: FrameState { iseq, insn_idx, pc, stack, locals } } =>
|
||||||
Snapshot {
|
Snapshot {
|
||||||
state: FrameState {
|
state: FrameState {
|
||||||
@ -763,8 +773,9 @@ impl Function {
|
|||||||
StringCopy { val } => StringCopy { val: find!(*val) },
|
StringCopy { val } => StringCopy { val: find!(*val) },
|
||||||
StringIntern { val } => StringIntern { val: find!(*val) },
|
StringIntern { val } => StringIntern { val: find!(*val) },
|
||||||
Test { val } => Test { val: find!(*val) },
|
Test { val } => Test { val: find!(*val) },
|
||||||
IfTrue { val, target } => IfTrue { val: find!(*val), target: target.clone() },
|
Jump(target) => Jump(find_branch_edge!(target)),
|
||||||
IfFalse { val, target } => IfFalse { val: find!(*val), target: target.clone() },
|
IfTrue { val, target } => IfTrue { val: find!(*val), target: find_branch_edge!(target) },
|
||||||
|
IfFalse { val, target } => IfFalse { val: find!(*val), target: find_branch_edge!(target) },
|
||||||
GuardType { val, guard_type, state } => GuardType { val: find!(*val), guard_type: *guard_type, state: *state },
|
GuardType { val, guard_type, state } => GuardType { val: find!(*val), guard_type: *guard_type, state: *state },
|
||||||
GuardBitEquals { val, expected, state } => GuardBitEquals { val: find!(*val), expected: *expected, state: *state },
|
GuardBitEquals { val, expected, state } => GuardBitEquals { val: find!(*val), expected: *expected, state: *state },
|
||||||
FixnumAdd { left, right, state } => FixnumAdd { left: find!(*left), right: find!(*right), state: *state },
|
FixnumAdd { left, right, state } => FixnumAdd { left: find!(*left), right: find!(*right), state: *state },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user