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]

[lto] fix PR40758 (an ICE)


Hi,

the issue here is that we blindly add SSA names to the used_in_copies 
bitmap in the !optimize case in order to try to coalesce all SSA names of 
the same base var.  That is all fine and well (there are no issues with 
overlapping life ranges as speculated in the bug report), except that we 
can only add names that are actually mentioned in the IR, using the same 
predicate that also is used by partition_view_init (it either has to be a 
real def or have some uses).

This patch fixes the testcase.  I'm regstrapping it on trunk, not LTO 
branch, and like to have approval for trunk, it's also a bug there.

The testcase from the bugreport only works for LTO, of course.  Somebody 
more knowledgeable than me might want to add it there when merging 
everything.


Ciao,
Michael.
-- 
	PR lto/40758
	* tree-ssa-coalesce.c (coalesce_ssa_name): Add only SSA names
	that are mentioned in the body.

Index: tree-ssa-coalesce.c
===================================================================
--- tree-ssa-coalesce.c	(Revision 152187)
+++ tree-ssa-coalesce.c	(Arbeitskopie)
@@ -1377,7 +1377,10 @@ coalesce_ssa_name (void)
 	{
 	  tree a = ssa_name (i);
 
-	  if (a && SSA_NAME_VAR (a) && !DECL_ARTIFICIAL (SSA_NAME_VAR (a)))
+	  if (a
+	      && SSA_NAME_VAR (a)
+	      && !DECL_ARTIFICIAL (SSA_NAME_VAR (a))
+	      && (!has_zero_uses (a) || !SSA_NAME_IS_DEFAULT_DEF (a)))
 	    {
 	      tree *slot = (tree *) htab_find_slot (ssa_name_hash, a, INSERT);
 


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