diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-13 20:17:42 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-17 18:03:24 +0100 |
commit | 09474b0a451bd4e3baea5e1a5e04f9b28f644bb3 (patch) | |
tree | 70b77d62b9a625e04398903dc1db51e7fa793a8e | |
parent | 5a7a06698fe2cd4ccb8d3f1a8585c70e6d8f7531 (diff) | |
download | sparse-09474b0a451bd4e3baea5e1a5e04f9b28f644bb3.tar.gz |
cfg: add missing REPEAT_CFG_CLEANUP
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>
-rw-r--r-- | linearize.c | 1 | ||||
-rw-r--r-- | simplify.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/linearize.c b/linearize.c index ab91113d..5d800b7f 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; } @@ -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 */ |