aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-02-08 22:07:52 +0100
committerChristopher Li <sparse@chrisli.org>2017-02-13 09:34:45 +0800
commit741d343b25781b4f9d62da6ca2fd402dfab52a2e (patch)
treeeec12921dbf24a286dcdb16f348fe676ffb23e66 /validation
parent4ea04a3a37c04b862152844170e371a8220664c6 (diff)
downloadsparse-dev-741d343b25781b4f9d62da6ca2fd402dfab52a2e.tar.gz
fix killing OP_SETVAL instructions
Currently, kill_instruction() ignore OP_SETVAL instructions with the result that some instructions are not optimized away as expected. For example, when looking at the output of test-linearize, the following function: static int kill_setval(void) { l: return &&l && 0; } gives the following output: kill_setval: set.64 %r6 <- .L1 ret.32 $0 The 'set' instruction is obviously unneeded but nevertheless present. With the patch, the output is the expected: kill_set: ret.32 $0 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-replaced-insn.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/validation/kill-replaced-insn.c b/validation/kill-replaced-insn.c
index be031b6c..92021877 100644
--- a/validation/kill-replaced-insn.c
+++ b/validation/kill-replaced-insn.c
@@ -30,6 +30,12 @@ static int kill_select(int a)
return (a ? 1 : 0) && 0;
}
+static int kill_setval(int a)
+{
+l:
+ return &&l && 0;
+}
+
static int kill_load(int *a)
{
return *a && 0;
@@ -51,4 +57,5 @@ static int kill_store(int *a)
* check-output-excludes: ptrcast\\.
* check-output-excludes: fpcast\\.
* check-output-excludes: sel\\.
+ * check-output-excludes: set\\.
*/