]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add a testcase to confirm the equivalence's are being checked by EVRP.
authorAndrew MacLeod <amacleod@redhat.com>
Thu, 24 Jun 2021 17:49:51 +0000 (13:49 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Thu, 24 Jun 2021 20:01:54 +0000 (16:01 -0400)
* gcc.dg/tree-ssa/evrp30.c: New.

gcc/testsuite/gcc.dg/tree-ssa/evrp30.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c
new file mode 100644 (file)
index 0000000..2c5ff41
--- /dev/null
@@ -0,0 +1,16 @@
+/* Confirm the ranger is picking up a relationship with equivalences.  */
+/* { dg-do compile } */
+/* { dg-options "-O2  -fdump-tree-evrp" } */
+
+extern void foo ();
+
+void f (unsigned int a, unsigned int b)
+{
+  if (a == b)
+    for (unsigned i = 0; i < a; i++)
+      if (i == b)   // Confirm  i < a also means i < b.
+       foo (); /* Unreachable */
+}
+
+/* { dg-final { scan-tree-dump-times "foo\\(" 0 "evrp"} } */
+