aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-02-16 05:56:56 +0100
committerChristopher Li <sparse@chrisli.org>2017-02-16 20:43:04 +0800
commita01240e7e357b19b1ab6511406d03058c71e0de4 (patch)
tree8724284e78e02e140a1d0aaa434dc6accb0b4a0e
parent3d17b5930d6a102fc97e8eb195ac2cf2ef10afa9 (diff)
downloadsparse-dev-a01240e7e357b19b1ab6511406d03058c71e0de4.tar.gz
fix killing of OP_PHIs
OP_PHIs were killed by calling clear_phi() but this function only replaces the phi node's sources by VOID without adjusting the usage of these sources. Fix this by instead calling kill_use() on each of the sources via the newly created helper kill_use_list(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r--simplify.c2
-rw-r--r--validation/kill-phi-node.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/simplify.c b/simplify.c
index d4e73089..17f1e2b6 100644
--- a/simplify.c
+++ b/simplify.c
@@ -218,7 +218,7 @@ void kill_instruction(struct instruction *insn)
break;
case OP_PHI:
- clear_phi(insn);
+ kill_use_list(insn->phi_list);
break;
case OP_PHISOURCE:
kill_use(&insn->phi_src);
diff --git a/validation/kill-phi-node.c b/validation/kill-phi-node.c
index 88de9f96..cff62b64 100644
--- a/validation/kill-phi-node.c
+++ b/validation/kill-phi-node.c
@@ -9,6 +9,15 @@ void foo(int a, int *b, unsigned int g)
d = 8;
}
+int bar(void);
+int bar(void)
+{
+ int i;
+ for (i = 0; i; i--)
+ ;
+ return 0;
+}
+
/*
* check-name: kill-phi-node
* check-command: test-linearize $file