diff mbox series

Allow PHIs to pick up global values.

Message ID d7d2a25b-6204-07da-82ed-61daff2c2d18@redhat.com
State New
Headers show
Series Allow PHIs to pick up global values. | expand

Commit Message

Andrew MacLeod June 29, 2021, 7:10 p.m. UTC
EVRP appears to allow PHIS to pick up global values before inlining.. 
This simply matches that behaviour with ranger and allows better 
equality when running in ranger-only mode..

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

Andrew
diff mbox series

Patch

From 604dce2d74d3417970e23e7ad38322d1adbca2e2 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Fri, 25 Jun 2021 15:31:39 -0400
Subject: [PATCH 2/3] Allow PHIs to pick up global values.

We can also apply known global values to PHI nodes in EVRP.

	* value-query.cc (gimple_range_global): Allow phis.
---
 gcc/value-query.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/value-query.cc b/gcc/value-query.cc
index 17dfdb1ccbe..730a2149275 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -419,7 +419,8 @@  gimple_range_global (tree name)
   gcc_checking_assert (gimple_range_ssa_p (name));
   tree type = TREE_TYPE (name);
 
-  if (SSA_NAME_IS_DEFAULT_DEF (name) || (cfun && cfun->after_inlining))
+  if (SSA_NAME_IS_DEFAULT_DEF (name) || (cfun && cfun->after_inlining)
+      || is_a<gphi *> (SSA_NAME_DEF_STMT (name)))
     {
       value_range vr;
       get_range_global (vr, name);
-- 
2.17.2