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(-)
@@ -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