[06/13] tree-inline decl_map: skip mapping result's NULL default def

Message ID orfsd1fpad.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. 27, 2022, 4:23 a.m. UTC
  If a result doesn't have a default def, don't attempt to remap it.

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


for  gcc/ChangeLog

	* tree-inline.cc (declare_return_variable): Don't remap NULL
	default def of result.
---
 gcc/tree-inline.cc |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
  

Comments

Jeff Law Dec. 27, 2022, 3:23 p.m. UTC | #1
On 12/26/22 21:23, Alexandre Oliva via Gcc-patches wrote:
> 
> If a result doesn't have a default def, don't attempt to remap it.
> 
> Regstrapped on x86_64-linux-gnu.  Ok to install?
> 
> 
> for  gcc/ChangeLog
> 
> 	* tree-inline.cc (declare_return_variable): Don't remap NULL
> 	default def of result.
OK
jeff
  

Patch

diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index bfea1cc11822e..4556256dc32b1 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -3851,10 +3851,11 @@  declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
 	 it's default_def SSA_NAME.  */
       if (gimple_in_ssa_p (id->src_cfun)
 	  && is_gimple_reg (result))
-	{
-	  temp = make_ssa_name (temp);
-	  insert_decl_map (id, ssa_default_def (id->src_cfun, result), temp);
-	}
+	if (tree default_def = ssa_default_def (id->src_cfun, result))
+	  {
+	    temp = make_ssa_name (temp);
+	    insert_decl_map (id, default_def, temp);
+	  }
       insert_init_stmt (id, entry_bb, gimple_build_assign (temp, var));
     }
   else