]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
path solver: Revert computation of ranges in gimple order.
authorAldy Hernandez <aldyh@redhat.com>
Thu, 25 Nov 2021 16:30:07 +0000 (17:30 +0100)
committerAldy Hernandez <aldyh@redhat.com>
Thu, 25 Nov 2021 16:34:31 +0000 (17:34 +0100)
Revert the patch below, as it may slow down compilation with large CFGs.

commit 8acbd7bef6edbf537e3037174907029b530212f6
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Nov 24 09:43:36 2021 +0100

    path solver: Compute ranges in path in gimple order.

gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::compute_ranges_defined): Remove.
(path_range_query::compute_ranges_in_block): Revert to bitmap order.
* gimple-range-path.h: Remove compute_ranges_defined.

gcc/gimple-range-path.cc
gcc/gimple-range-path.h

index 806bce9ff11d2eb7b5110c85b09e0a12ba341c51..b9c71226c1c7ff2999f73d5bbc5b4edf07ba4fa8 100644 (file)
@@ -401,27 +401,6 @@ path_range_query::compute_ranges_in_phis (basic_block bb)
     }
 }
 
-// Compute ranges defined in block.
-
-void
-path_range_query::compute_ranges_defined (basic_block bb)
-{
-  int_range_max r;
-
-  compute_ranges_in_phis (bb);
-
-  // Iterate in gimple order to minimize recursion.
-  for (auto gsi = gsi_start_nondebug_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-    if (gimple_has_lhs (gsi_stmt (gsi)))
-      {
-       tree name = gimple_get_lhs (gsi_stmt (gsi));
-       if (TREE_CODE (name) == SSA_NAME
-           && bitmap_bit_p (m_imports, SSA_NAME_VERSION (name))
-           && range_defined_in_block (r, name, bb))
-         set_cache (r, name);
-      }
-}
-
 // Compute ranges defined in the current block, or exported to the
 // next block.
 
@@ -444,7 +423,17 @@ path_range_query::compute_ranges_in_block (basic_block bb)
        clear_cache (name);
     }
 
-  compute_ranges_defined (bb);
+  // Solve imports defined in this block, starting with the PHIs...
+  compute_ranges_in_phis (bb);
+  // ...and then the rest of the imports.
+  EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi)
+    {
+      tree name = ssa_name (i);
+
+      if (gimple_code (SSA_NAME_DEF_STMT (name)) != GIMPLE_PHI
+         && range_defined_in_block (r, name, bb))
+       set_cache (r, name);
+    }
 
   if (at_exit ())
     return;
index 81c87d475dd67de0dd73ae2f23a40c808ad17d66..57a9ae9bdcd86192d180abd3fd74583330cfe1dd 100644 (file)
@@ -58,7 +58,6 @@ private:
   // Methods to compute ranges for the given path.
   bool range_defined_in_block (irange &, tree name, basic_block bb);
   void compute_ranges_in_block (basic_block bb);
-  void compute_ranges_defined (basic_block bb);
   void compute_ranges_in_phis (basic_block bb);
   void adjust_for_non_null_uses (basic_block bb);
   void ssa_range_in_phi (irange &r, gphi *phi);