]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not calculate an entry range for invariant names.
authorAndrew MacLeod <amacleod@redhat.com>
Mon, 25 Nov 2024 14:50:33 +0000 (09:50 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Fri, 6 Dec 2024 21:32:16 +0000 (16:32 -0500)
If an SSA_NAME is invariant, do not calculate an on_entry value.

PR tree-optimization/117467
* gimple-range-cache.cc (ranger_cache::entry_range): Do not
invoke range_from_dom for invariant ssa-names.

gcc/gimple-range-cache.cc

index 8b7189eb5b83f3304da6da7f5a905a5ee7bdc188..c9016fe988db6f2455c31f49c5c9670ceb0ab7ea 100644 (file)
@@ -1183,6 +1183,13 @@ ranger_cache::entry_range (vrange &r, tree name, basic_block bb,
       return;
     }
 
+  // If NAME is invariant, simply return the defining range.
+  if (!gori ().has_edge_range_p (name))
+    {
+      range_of_def (r, name);
+      return;
+    }
+
   // Look for the on-entry value of name in BB from the cache.
   // Otherwise pick up the best available global value.
   if (!m_on_entry.get_bb_range (r, name, bb))