[14/17] parloops: don't request insert that won't be completed

Message ID ora637emmo.fsf@lxoliva.fsfla.org
State Accepted
Headers
Series [01/13] scoped tables: insert before further lookups |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Alexandre Oliva Dec. 28, 2022, 12:30 p.m. UTC
  In take_address_of, we may refrain from completing a decl_address
INSERT if gsi is NULL, so dnn't even ask for an INSERT in this case.

Regstrapped on x86_64-linux-gnu.  Ok to install?


for  gcc/ChangeLog

	* tree-parloops.cc (take_address_of): Skip INSERT if !gsi.
---
 gcc/tree-parloops.cc |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Jeff Law Dec. 29, 2022, 2:44 a.m. UTC | #1
On 12/28/22 05:30, Alexandre Oliva via Gcc-patches wrote:
> 
> In take_address_of, we may refrain from completing a decl_address
> INSERT if gsi is NULL, so dnn't even ask for an INSERT in this case.
> 
> Regstrapped on x86_64-linux-gnu.  Ok to install?
> 
> 
> for  gcc/ChangeLog
> 
> 	* tree-parloops.cc (take_address_of): Skip INSERT if !gsi.
OK
jeff
  

Patch

diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index e680d97dd0497..b829ba7b873b6 100644
--- a/gcc/tree-parloops.cc
+++ b/gcc/tree-parloops.cc
@@ -1221,8 +1221,11 @@  take_address_of (tree obj, tree type, edge entry,
   uid = DECL_UID (TREE_OPERAND (TREE_OPERAND (*var_p, 0), 0));
   int_tree_map elt;
   elt.uid = uid;
-  int_tree_map *slot = decl_address->find_slot (elt, INSERT);
-  if (!slot->to)
+  int_tree_map *slot = decl_address->find_slot (elt,
+						gsi == NULL
+						? NO_INSERT
+						: INSERT);
+  if (!slot || !slot->to)
     {
       if (gsi == NULL)
 	return NULL;