From patchwork Mon Jun 28 18:09:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix libstdc++ 32bit failures From: Jan Hubicka X-Patchwork-Id: 57178 Message-Id: <20100628180912.GG6233@kam.mff.cuni.cz> To: gcc-patches@gcc.gnu.org, rguenther@suse.de Date: Mon, 28 Jun 2010 20:09:12 +0200 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. 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; }