Skip to content

Commit

Permalink
Fix isolated branch in SSA
Browse files Browse the repository at this point in the history
  • Loading branch information
vacantron committed Jan 7, 2024
1 parent 9daeaef commit 911e7dc
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/ssa.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,18 +651,16 @@ void append_unwound_phi_insn(basic_block_t *bb, var_t *dest, var_t *rs)
} else {
/* insert it before branch instruction */
if (tail->opcode == OP_branch) {
insn_t *prev = bb->insn_list.head;
if (!prev->next) {
if (tail->prev) {
tail->prev->next = n;
n->prev = tail->prev;
} else
bb->insn_list.head = n;
n->next = prev;
} else {
while (prev->next != tail)
prev = prev->next;
prev->next = n;
n->next = tail;
}

n->next = tail;
tail->prev = n;
} else {
bb->insn_list.tail->next = n;
tail->next = n;
bb->insn_list.tail = n;
}
}
Expand Down

0 comments on commit 911e7dc

Please sign in to comment.