aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-02-19 07:25:33 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-03-19 23:56:44 +0100
commitc59ba8c0b5d699256651755eed6f421667751d33 (patch)
treed800ed8089c7f72f44afcfc56f9ee702a3c8333c
parent752914c764b6d396c8e0a7c4ab207181edf7b00e (diff)
downloadsparse-c59ba8c0b5d699256651755eed6f421667751d33.tar.gz
fix phisources during CBR-BR conversion
When a parent is removed from a BB containing one or several phi-nodes, the corresponding phi-sources must be removed from the phi-node. However this is not done and consequentially: * it becomes impossibly to correctly reason about the flow of values through these phi-nodes. * simplifications are missed (e.g. if-conversion). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--flow.c5
-rw-r--r--validation/optim/bad-phisrc1.c1
-rw-r--r--validation/optim/bad-phisrc1a.c1
3 files changed, 5 insertions, 2 deletions
diff --git a/flow.c b/flow.c
index 4952562a..69d95a98 100644
--- a/flow.c
+++ b/flow.c
@@ -760,6 +760,11 @@ int convert_to_jump(struct instruction *insn, struct basic_block *target)
struct basic_block *child;
int changed = REPEAT_CSE;
+ switch (insn->opcode) {
+ case OP_CBR:
+ changed |= remove_phisources(insn->bb, insn->bb_true == target ? insn->bb_false : insn->bb_true);
+ break;
+ }
kill_use(&insn->cond);
insn->bb_true = target;
insn->bb_false = NULL;
diff --git a/validation/optim/bad-phisrc1.c b/validation/optim/bad-phisrc1.c
index 59c5e4f1..aa12dd0a 100644
--- a/validation/optim/bad-phisrc1.c
+++ b/validation/optim/bad-phisrc1.c
@@ -8,7 +8,6 @@ void foo(int a, int b)
/*
* check-name: bad-phisrc1
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-excludes: phi\\.
diff --git a/validation/optim/bad-phisrc1a.c b/validation/optim/bad-phisrc1a.c
index cf07573b..b7519ee7 100644
--- a/validation/optim/bad-phisrc1a.c
+++ b/validation/optim/bad-phisrc1a.c
@@ -16,7 +16,6 @@ out:
/*
* check-name: bad-phisrc1a
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-contains: select\\.