aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/memops
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-01-06 01:01:18 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-11-29 23:06:59 +0100
commit701ce0cadbd5eb0655ab0c33de5c8a337a498a34 (patch)
tree5e398f1e90946d6fd85c6dd8dc52587dd897df4a /validation/memops
parent540c2c4bf47f0c517c042ff689679b2900bb36a5 (diff)
downloadsparse-dev-701ce0cadbd5eb0655ab0c33de5c8a337a498a34.tar.gz
memops: kill dead loads before phi-node conversion
During load simplification it may happen that a load is unused but if this fact is ignored and the usual conversion to a phi-node is made, then this value may seem to be needed and can't anymore be simplified away. Fix this by removing dead loads during load simplification. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/memops')
-rw-r--r--validation/memops/kill-dead-loads00.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/validation/memops/kill-dead-loads00.c b/validation/memops/kill-dead-loads00.c
new file mode 100644
index 00000000..df7ec037
--- /dev/null
+++ b/validation/memops/kill-dead-loads00.c
@@ -0,0 +1,22 @@
+void fun(void);
+
+void foo(int *p)
+{
+ for (*p; *p; *p) {
+l:
+ fun();
+ }
+
+ if (0)
+ goto l;
+}
+
+/*
+ * check-name: kill-dead-loads00
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-excludes: phi\\.
+ * check-output-pattern(1): load\\.
+ * check-output-end
+ */