diff mbox series

[COMMITTED] PR-tree-optimization/103093 - Remove def chain import assert from GORI.

Message ID c41e711b-2162-8f29-f917-118a1c526bcc@redhat.com
State New
Headers show
Series [COMMITTED] PR-tree-optimization/103093 - Remove def chain import assert from GORI. | expand

Commit Message

Andrew MacLeod Nov. 5, 2021, 5:17 p.m. UTC
As detailed in the PR, when the IL is changing between queries, the 
imports and def chains of an ssa-name may change,a nd when coparing with 
a newly created ssa-name, certain assumptions about presence/lack of 
presence between lists may no longer be true.

This patch simply removes the offending assert.

Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed.

Andrew
diff mbox series

Patch

From 1f6dd5de33912c261a5003150212c290165ac1b6 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Fri, 5 Nov 2021 11:25:09 -0400
Subject: [PATCH 2/2] Remove def chain import assert from GORI.

When the IL has changed, any new ssa-names import calculations may not jive
with existing ssa-names, so just remove the assert.

	gcc/
	PR tree-optimization/103093
	* gimple-range-gori.cc (range_def_chain::get_imports): Remove assert.

	gcc/testsuite/
	* gcc.dg/pr103093.c: New.
---
 gcc/gimple-range-gori.cc        |  3 ---
 gcc/testsuite/gcc.dg/pr103093.c | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/pr103093.c

diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 2e58c23216b..fb2d571ef44 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -226,9 +226,6 @@  range_def_chain::get_imports (tree name)
   if (!has_def_chain (name))
     get_def_chain (name);
   bitmap i = m_def_chain[SSA_NAME_VERSION (name)].m_import;
-  // Either this is a default def,  OR imports must be a subset of exports.
-  gcc_checking_assert (!get_def_chain (name) || !i
-		       || !bitmap_intersect_compl_p (i, get_def_chain (name)));
   return i;
 }
 
diff --git a/gcc/testsuite/gcc.dg/pr103093.c b/gcc/testsuite/gcc.dg/pr103093.c
new file mode 100644
index 00000000000..f42572147ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr103093.c
@@ -0,0 +1,20 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int i_0, c_4, uc_7, func_2_c_11;
+
+short *func_2_ptr_10;
+
+void func_2() {
+  uc_7 = 7;
+  for (; uc_7 <= 60; uc_7 += 1) {
+    c_4 = 5;
+    for (; c_4 <= 76; c_4 += 1) {
+      func_2_ptr_10 = &i_0;	/* { dg-warning "assignment to .*" } */
+      if ((i_0 |= 5) > 0 ?: (60 && uc_7) | *func_2_ptr_10)
+        if (func_2_c_11)
+          for (;;)
+            ;
+    }
+  }
+}
-- 
2.17.2