Message ID | 20201116222927.51939-7-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | cfg: early CFG simplification | expand |
diff --git a/linearize.c b/linearize.c index ab91113d00eb..5d800b7f4006 100644 --- a/linearize.c +++ b/linearize.c @@ -726,6 +726,7 @@ void insert_branch(struct basic_block *bb, struct instruction *jmp, struct basic remove_parent(child, bb); } END_FOR_EACH_PTR(child); PACK_PTR_LIST(&bb->children); + repeat_phase |= REPEAT_CFG_CLEANUP; } diff --git a/simplify.c b/simplify.c index e58fb6cf3941..a0e23d6de01f 100644 --- a/simplify.c +++ b/simplify.c @@ -2048,7 +2048,7 @@ static int simplify_branch(struct instruction *insn) kill_use(&insn->cond); insn->cond = NULL; insn->opcode = OP_BR; - return REPEAT_CSE; + return REPEAT_CSE|REPEAT_CFG_CLEANUP; } /* Conditional on a SETNE $0 or SETEQ $0 */
simplify_branch() & insert_branch() convert a conditional branch into an unconditional one, removing a child which may then become unreachable. However, these function doesn't set REPEAT_CFG_CLEANUP and the unreachable child may not be removed. Fix this by setting the missing REPEAT_CFG_CLEANUP in these functions. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- linearize.c | 1 + simplify.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)