aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/mem2reg/load-deadborn.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-12 15:08:54 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-14 12:39:19 +0100
commit488b3f379e42358e5815c6320baec9113349d585 (patch)
treedf5965445c86636c2698b24dba07a4eb2e25845d /validation/mem2reg/load-deadborn.c
parentfdd1645dc1a80d76dfffb621cfca778d1ce12d52 (diff)
downloadsparse-dev-488b3f379e42358e5815c6320baec9113349d585.tar.gz
fix usage of deadborn loads
In some situations, loads and others instructions can be unreachable already when linearized, for example in code like: void foo(int *ptr) { return; *ptr; } Such loads are detected in find_dominating_stores() and must be discarded. This is done and the load have its opcode set to OP_LNOP (wich is only useful for debugging) but it's address is left as being used by the load. Fix this by removing the address usage. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/mem2reg/load-deadborn.c')
-rw-r--r--validation/mem2reg/load-deadborn.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/validation/mem2reg/load-deadborn.c b/validation/mem2reg/load-deadborn.c
new file mode 100644
index 00000000..fa0baeae
--- /dev/null
+++ b/validation/mem2reg/load-deadborn.c
@@ -0,0 +1,9 @@
+static void foo(int a)
+{
+ return;
+ a;
+}
+
+/*
+ * check-name: load-deadborn
+ */