add killing of OP_PHISOURCEs
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
diff --git a/simplify.c b/simplify.c
index 90e45bf..ced63bf 100644
--- a/simplify.c
+++ b/simplify.c
@@ -210,6 +210,9 @@
case OP_PHI:
clear_phi(insn);
break;
+ case OP_PHISOURCE:
+ kill_use(&insn->phi_src);
+ break;
case OP_SYMADDR:
repeat_phase |= REPEAT_SYMBOL_CLEANUP;
diff --git a/validation/kill-phisrc.c b/validation/kill-phisrc.c
new file mode 100644
index 0000000..f00dbed
--- /dev/null
+++ b/validation/kill-phisrc.c
@@ -0,0 +1,21 @@
+int foo(int a, int b)
+{
+ int r = a + b;
+
+ if (a && 0) {
+ int s = r;
+ if (b)
+ s = 0;
+ (void) s;
+ }
+
+ return 0;
+}
+
+/*
+ * check-name: kill-phisrc
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-excludes: add\\.
+ */