Patchwork Fix libstdc++ 32bit failures

login
register
mail settings
Submitter Jan Hubicka
Date June 28, 2010, 6:09 p.m.
Message ID <20100628180912.GG6233@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/57178/
State New
Headers show

Comments

Jan Hubicka - June 28, 2010, 6:09 p.m.
Hi,
so after long hunt I finally found the problem.  The reason is that on i386 we compile
functions to use result_decl directly, while on x86_64 we store everything into __i
variable and then copy it into result decl (that is much less effective, I would like
to know why it happens too).

Now ipa-split comes into game and it does not consider writes into retval decl in header
as a reason to prevent splitting that effectively makes result decl input/output var that
later confuse aliasing.

The following patch prevents splitting when retval decl is modified both in
header and split part that effectively prevents splitting on these functions
(header will modify split part on the path to return that almost always exist).
I will work on better solution - we should ask alias oracle any use of non-ssa
variable in split part has dependency on set in header.  This holds for other
non-SSA uses too, but that can be handled incrementally.

Also in 64bit mode ipa-split probably should not give up when return block contains just
an assignment.

This patch should unbreak libstdc++ on 32bit.
Bootstrapping/regtesting x86_64 and will commit once it passes.

Honza

	PR middle-end/44671
	* ipa-split.c (test_nonssa_use, mark_nonssa_use): Check also uses of RESULT_DECL.

Patch

Index: ipa-split.c
===================================================================
--- ipa-split.c	(revision 161500)
+++ ipa-split.c	(working copy)
@@ -138,6 +138,7 @@  test_nonssa_use (gimple stmt ATTRIBUTE_U
   if (t && !is_gimple_reg (t)
       && ((TREE_CODE (t) == VAR_DECL
 	  && auto_var_in_fn_p (t, current_function_decl))
+	  || (TREE_CODE (t) == RESULT_DECL)
 	  || (TREE_CODE (t) == PARM_DECL)))
     return bitmap_bit_p ((bitmap)data, DECL_UID (t));
   return false;
@@ -441,7 +442,8 @@  mark_nonssa_use (gimple stmt ATTRIBUTE_U
       return true;
     }
 
-  if (TREE_CODE (t) == VAR_DECL && auto_var_in_fn_p (t, current_function_decl))
+  if ((TREE_CODE (t) == VAR_DECL && auto_var_in_fn_p (t, current_function_decl))
+      || (TREE_CODE (t) == RESULT_DECL))
     bitmap_set_bit ((bitmap)data, DECL_UID (t));
   return false;
 }