aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-02-16 05:57:07 +0100
committerChristopher Li <sparse@chrisli.org>2017-02-16 20:43:12 +0800
commit9d88dc64ceefc36c23ce89917a8d2f72d2419b3c (patch)
tree9d063ce3a25b9c9a3739c4a83f1eba0d29709582 /validation
parent75d548d5b14d492432fcac1a6dc29c07f57faaac (diff)
downloadsparse-dev-9d88dc64ceefc36c23ce89917a8d2f72d2419b3c.tar.gz
use kill_instruction() when killing any instructions during CSE
Instructions removed during CSE had their ->bb simply set to NULL and the usage of their operand was not adjusted. Fix that by calling kill_instruction(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/kill-cse.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/validation/kill-cse.c b/validation/kill-cse.c
new file mode 100644
index 00000000..2e2b1024
--- /dev/null
+++ b/validation/kill-cse.c
@@ -0,0 +1,21 @@
+int foo(int a)
+{
+ return ((a == 0) + 1) != ((a == 0) + 1);
+}
+
+/*
+ * check-name: kill-cse
+ * check-description:
+ * Verify that instructions removed at CSE are
+ * properly adjust the usage of their operands.
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-start
+foo:
+.L0:
+ <entry-point>
+ ret.32 $0
+
+
+ * check-output-end
+ */