This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix parts of PR55792


I think that PR55792 shows we still have locations in our IL
with BLOCKs that are not in the functions BLOCK tree which
will lead to hard to trigger GC issues with location/BLOCKs
merged into location_t now.

The following fixes one issue I noticed when writing a verifier
for locations.  remove_unused_scope_blocks does not consider
virtual PHIs when keeping BLOCKs live - which is IMHO sensible.
Thus the following patch makes sure we do not set locations
of virtual PHI args.

Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu
(with the checker enabled ... which I'll post separately).

Thanks,
Richard.

2013-01-10  Richard Biener  <rguenther@suse.de>

	PR bootstrap/55792
	* tree-into-ssa.c (rewrite_add_phi_arguments): Do not set
	locations for virtual PHI arguments.
	(rewrite_update_phi_arguments): Likewise.

Index: gcc/tree-into-ssa.c
===================================================================
*** gcc/tree-into-ssa.c	(revision 195079)
--- gcc/tree-into-ssa.c	(working copy)
*************** rewrite_add_phi_arguments (basic_block b
*** 1355,1367 ****
        for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi);
  	   gsi_next (&gsi))
  	{
! 	  tree currdef;
! 	  gimple stmt;
  
  	  phi = gsi_stmt (gsi);
! 	  currdef = get_reaching_def (SSA_NAME_VAR (gimple_phi_result (phi)));
! 	  stmt = SSA_NAME_DEF_STMT (currdef);
! 	  add_phi_arg (phi, currdef, e, gimple_location (stmt));
  	}
      }
  }
--- 1355,1372 ----
        for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi);
  	   gsi_next (&gsi))
  	{
! 	  tree currdef, res;
! 	  location_t loc;
  
  	  phi = gsi_stmt (gsi);
! 	  res = gimple_phi_result (phi);
! 	  currdef = get_reaching_def (SSA_NAME_VAR (res));
! 	  /* Virtual operand PHI args do not need a location.  */
! 	  if (virtual_operand_p (res))
! 	    loc = UNKNOWN_LOCATION;
! 	  else
! 	    loc = gimple_location (SSA_NAME_DEF_STMT (currdef));
! 	  add_phi_arg (phi, currdef, e, loc);
  	}
      }
  }
*************** rewrite_update_phi_arguments (basic_bloc
*** 2018,2037 ****
            /* Update the argument if there is a reaching def.  */
  	  if (reaching_def)
  	    {
- 	      gimple stmt;
  	      source_location locus;
  	      int arg_i = PHI_ARG_INDEX_FROM_USE (arg_p);
  
  	      SET_USE (arg_p, reaching_def);
- 	      stmt = SSA_NAME_DEF_STMT (reaching_def);
  
! 	      /* Single element PHI nodes  behave like copies, so get the
! 		 location from the phi argument.  */
! 	      if (gimple_code (stmt) == GIMPLE_PHI &&
! 		  gimple_phi_num_args (stmt) == 1)
! 		locus = gimple_phi_arg_location (stmt, 0);
  	      else
! 		locus = gimple_location (stmt);
  
  	      gimple_phi_arg_set_location (phi, arg_i, locus);
  	    }
--- 2023,2048 ----
            /* Update the argument if there is a reaching def.  */
  	  if (reaching_def)
  	    {
  	      source_location locus;
  	      int arg_i = PHI_ARG_INDEX_FROM_USE (arg_p);
  
  	      SET_USE (arg_p, reaching_def);
  
! 	      /* Virtual operands do not need a location.  */
! 	      if (virtual_operand_p (reaching_def))
! 		locus = UNKNOWN_LOCATION;
  	      else
! 		{
! 		  gimple stmt = SSA_NAME_DEF_STMT (reaching_def);
! 
! 		  /* Single element PHI nodes  behave like copies, so get the
! 		     location from the phi argument.  */
! 		  if (gimple_code (stmt) == GIMPLE_PHI
! 		      && gimple_phi_num_args (stmt) == 1)
! 		    locus = gimple_phi_arg_location (stmt, 0);
! 		  else
! 		    locus = gimple_location (stmt);
! 		}
  
  	      gimple_phi_arg_set_location (phi, arg_i, locus);
  	    }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]