Skip to content

Commit 19f0df0

Browse files
committed
ZJIT: Fix definite assignment to work with multiple entry blocks
1 parent c764269 commit 19f0df0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

zjit/src/hir.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,11 +4165,13 @@ impl Function {
41654165
// missing location.
41664166
let mut assigned_in = vec![None; self.num_blocks()];
41674167
let rpo = self.rpo();
4168-
// Begin with every block having every variable defined, except for the entry block, which
4169-
// starts with nothing defined.
4170-
assigned_in[self.entry_block.0] = Some(InsnSet::with_capacity(self.insns.len()));
4168+
// Begin with every block having every variable defined, except for the entry blocks, which
4169+
// start with nothing defined.
4170+
let entry_blocks = self.entry_blocks();
41714171
for &block in &rpo {
4172-
if block != self.entry_block {
4172+
if entry_blocks.contains(&block) {
4173+
assigned_in[block.0] = Some(InsnSet::with_capacity(self.insns.len()));
4174+
} else {
41734175
let mut all_ones = InsnSet::with_capacity(self.insns.len());
41744176
all_ones.insert_all();
41754177
assigned_in[block.0] = Some(all_ones);

0 commit comments

Comments
 (0)