aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-02-19 07:26:49 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-03-19 23:56:44 +0100
commita45f9140a0c237f1b2f82e66595dba6426c5b598 (patch)
tree973fe7bdeb3816c60da879f6d0fe21cc51bef353
parentc59ba8c0b5d699256651755eed6f421667751d33 (diff)
downloadsparse-a45f9140a0c237f1b2f82e66595dba6426c5b598.tar.gz
use convert_to_jump() when converting a CBR with same targets
If a conditional branch has identical targets, it should be converted to a simple jump. This is done but using its own code. Change this by using the existing convert_to_jump() instead. This also allows any redundant phi-sources to be removed. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--simplify.c13
-rw-r--r--validation/optim/bad-phisrc2.c1
2 files changed, 2 insertions, 12 deletions
diff --git a/simplify.c b/simplify.c
index 7171bd56..90db041a 100644
--- a/simplify.c
+++ b/simplify.c
@@ -2444,17 +2444,8 @@ static int simplify_branch(struct instruction *insn)
return convert_to_jump(insn, cond->value ? insn->bb_true : insn->bb_false);
/* Same target? */
- if (insn->bb_true == insn->bb_false) {
- struct basic_block *bb = insn->bb;
- struct basic_block *target = insn->bb_false;
- remove_bb_from_list(&target->parents, bb, 1);
- remove_bb_from_list(&bb->children, target, 1);
- insn->bb_false = NULL;
- kill_use(&insn->cond);
- insn->cond = NULL;
- insn->opcode = OP_BR;
- return REPEAT_CSE|REPEAT_CFG_CLEANUP;
- }
+ if (insn->bb_true == insn->bb_false)
+ return convert_to_jump(insn, insn->bb_true);
/* Conditional on a SETNE $0 or SETEQ $0 */
if (cond->type == PSEUDO_REG) {
diff --git a/validation/optim/bad-phisrc2.c b/validation/optim/bad-phisrc2.c
index 3eade688..78eae288 100644
--- a/validation/optim/bad-phisrc2.c
+++ b/validation/optim/bad-phisrc2.c
@@ -10,7 +10,6 @@ int bad_phisrc2(int p, int a, int r)
/*
* check-name: bad-phisrc2
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-contains: select\\.