aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/mem2reg/dead-phisrc.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-14 00:29:16 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-14 16:29:38 +0100
commit9b69a4bfa543068f5bfd23edd2c7b2b41300cb9a (patch)
tree7a2168457275e2bd8191e25133ad907d3ffc631d /validation/mem2reg/dead-phisrc.c
parentd2ca9a9ceb2cb6437b3b01fc5b3819df4e071e34 (diff)
downloadsparse-dev-9b69a4bfa543068f5bfd23edd2c7b2b41300cb9a.tar.gz
cleanup deadborn phi-sources
In simplify_loads(), phisrcs are created in find_dominating_parents() and are then supposed to be used in rewrite_load_instruction(). However, it may happen (quite often) that find_dominating_parents() find a dominator for one of the branch, create a phi-source for it, record it's usage and then doesn't find a dominator in one of other parent branches. In this case, the function returns early and the created phisrcs are simply ignored. These phisrcs can't be simplified away as dead instructions because they still have their usage recorded. Fix this by explicitly remove these ignored phisrcs. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/mem2reg/dead-phisrc.c')
-rw-r--r--validation/mem2reg/dead-phisrc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/validation/mem2reg/dead-phisrc.c b/validation/mem2reg/dead-phisrc.c
new file mode 100644
index 00000000..4e4f6a8b
--- /dev/null
+++ b/validation/mem2reg/dead-phisrc.c
@@ -0,0 +1,17 @@
+static void foo(void)
+{
+ extern int *a;
+
+ if (a || *a)
+ ;
+ if (a[0] || a[1])
+ ;
+}
+
+/*
+ * check-name: dead-phisrc
+ * check-command: test-linearize $file
+ *
+ * check-output-ignore
+ * check-output-excludes: phisrc
+ */