Adding a testcase which shows the equivalence/relation engine working as it should.

pushed.

Andrew


>From ce3316e9c02c81c509173572c71a101f4eb62a24 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacl...@redhat.com>
Date: Thu, 24 Jun 2021 13:49:51 -0400
Subject: [PATCH 2/2] Add a testcase to confirm the equivalence's are being
 checked by EVRP.

	* gcc.dg/tree-ssa/evrp30.c: New.
---
 gcc/testsuite/gcc.dg/tree-ssa/evrp30.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/evrp30.c

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c
new file mode 100644
index 00000000000..2c5ff41ecd9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp30.c
@@ -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"} } */
+
-- 
2.17.2

Reply via email to