public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4486] Process EH edges again and call get_tree_range on non gimple_range_ssa_p names.
@ 2021-10-18 22:02 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2021-10-18 22:02 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4d92a69fc5882c86aab63d52382b393d4f20b3ed

commit r12-4486-g4d92a69fc5882c86aab63d52382b393d4f20b3ed
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Oct 18 13:52:18 2021 -0400

    Process EH edges again and call get_tree_range on non gimple_range_ssa_p names.
    
            PR tree-optimization/102796
            gcc/
            * gimple-range.cc (gimple_ranger::range_on_edge): Process EH edges
            normally.  Return get_tree_range for non gimple_range_ssa_p names.
            (gimple_ranger::range_of_stmt): Use get_tree_range for non
            gimple_range_ssa_p names.
    
            gcc/testsuite/
            * g++.dg/pr102796.C: New.

Diff:
---
 gcc/gimple-range.cc             | 10 +++++-----
 gcc/testsuite/g++.dg/pr102796.C | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 85ef9745593..93d6da66ccb 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -180,9 +180,9 @@ gimple_ranger::range_on_edge (irange &r, edge e, tree name)
   int_range_max edge_range;
   gcc_checking_assert (irange::supports_type_p (TREE_TYPE (name)));
 
-  // Do not process values along abnormal or EH edges.
-  if (e->flags & (EDGE_ABNORMAL|EDGE_EH))
-    return false;
+  // Do not process values along abnormal edges.
+  if (e->flags & EDGE_ABNORMAL)
+    return get_tree_range (r, name, NULL);
 
   unsigned idx;
   if ((idx = tracer.header ("range_on_edge (")))
@@ -203,7 +203,7 @@ gimple_ranger::range_on_edge (irange &r, edge e, tree name)
 
   bool res = true;
   if (!gimple_range_ssa_p (name))
-    res = range_of_expr (r, name);
+    return get_tree_range (r, name, NULL);
   else
     {
       range_on_exit (r, e->src, name);
@@ -258,7 +258,7 @@ gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name)
   if (!name)
     res = fold_range_internal (r, s, NULL_TREE);
   else if (!gimple_range_ssa_p (name))
-    res = false;
+    res = get_tree_range (r, name, NULL);
   // Check if the stmt has already been processed, and is not stale.
   else if (m_cache.get_non_stale_global_range (r, name))
     {
diff --git a/gcc/testsuite/g++.dg/pr102796.C b/gcc/testsuite/g++.dg/pr102796.C
new file mode 100644
index 00000000000..6ad1008922f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr102796.C
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-O3 -fno-tree-ccp -fno-tree-fre -fno-tree-forwprop -std=c++17" }
+
+namespace std {
+template <class _E>
+struct initializer_list {
+  const int* __begin_;
+  decltype(sizeof(int)) __size_;
+};
+}  // namespace std
+struct destroyme1 {};
+struct witharg1 {
+  witharg1(const destroyme1&);
+  ~witharg1();
+};
+std::initializer_list globalInitList2 = {witharg1(destroyme1()),
+                                         witharg1(destroyme1())};
+


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-18 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 22:02 [gcc r12-4486] Process EH edges again and call get_tree_range on non gimple_range_ssa_p names Andrew Macleod

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).