aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-11 16:47:18 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-17 18:21:21 +0100
commit5953ebb1f87141a268fc9a214b982079d1138410 (patch)
tree8616b5792cbb76b4ee80ce8930c1232a6694cc46 /validation
parent4a036fd55cb47e88119c792018904511401ddd79 (diff)
downloadsparse-dev-5953ebb1f87141a268fc9a214b982079d1138410.tar.gz
optim: simplify null select
A select instruction like: select r <- x, 0, x always gives zero as result but the optimizer doesn't this. Change this by teaching the optimizer about it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/optim/select-zero.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/validation/optim/select-zero.c b/validation/optim/select-zero.c
new file mode 100644
index 00000000..ed737bff
--- /dev/null
+++ b/validation/optim/select-zero.c
@@ -0,0 +1,16 @@
+static int sel0(int a)
+{
+ if (a)
+ return 0;
+ else
+ return a;
+}
+
+/*
+ * check-name: select-zero
+ * check-command: test-linearize $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret.32 *\\$0
+ * check-output-excludes: select\\.
+ */