From patchwork Wed Jun 30 12:14:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 57405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 80F65B6EED for ; Wed, 30 Jun 2010 22:15:06 +1000 (EST) Received: (qmail 15867 invoked by alias); 30 Jun 2010 12:14:59 -0000 Received: (qmail 15856 invoked by uid 22791); 30 Jun 2010 12:14:57 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Jun 2010 12:14:51 +0000 Received: from localhost (occam.ms.mff.cuni.cz [195.113.18.121]) by nikam.ms.mff.cuni.cz (Postfix) with ESMTP id 41D1E9AC7C7; Wed, 30 Jun 2010 14:14:49 +0200 (CEST) Received: by localhost (Postfix, from userid 16202) id 3C95C56415F; Wed, 30 Jun 2010 14:14:49 +0200 (CEST) Date: Wed, 30 Jun 2010 14:14:49 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de Subject: PR middle-end/PR44706 (xalancbmk ICE) Message-ID: <20100630121448.GJ6233@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, this is patch I am just testing for middle-end/PR44706. I originally just produced temporary for return value, but this breaks in some cases wehere we must use retval. So I changed it to use retval always that breaks in case where we expect temporary. Gimplifier uses aggregate_value_p to make the decision and after dicussion with Richi I also added !DECL_BY_REFERENCE (that is currently not used, I will try to enable splitting of those functions next) Bootstrapped/regtested x86_64-linux, OK if it passes testing with the testcase added to torture? class MemoryManager; class XMLExcepts { public : enum Codes { AttrList_BadIndex }; }; class XMLException { public: XMLException(const char* const srcFile, const unsigned int srcLine, MemoryManager* const memoryManager = 0); }; class ArrayIndexOutOfBoundsException : public XMLException { public: ArrayIndexOutOfBoundsException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) { } }; class XMLAttDef { bool fExternalAttribute; }; class XMLAttDefList { public: MemoryManager* getMemoryManager() const; }; class DTDAttDef : public XMLAttDef { }; class DTDAttDefList : public XMLAttDefList { virtual const XMLAttDef &getAttDef(unsigned int index) const ; DTDAttDef** fArray; unsigned int fCount; }; const XMLAttDef &DTDAttDefList::getAttDef(unsigned int index) const { if(index >= fCount) throw ArrayIndexOutOfBoundsException("foo.cpp", 0, XMLExcepts::AttrList_BadIndex, getMemoryManager()); return *(fArray[index]); } PR middle-end/PR44706 * ipa-split (split_function): Refine conditions when to use DECL_RESULT to return the value. Index: ipa-split.c =================================================================== --- ipa-split.c (revision 161597) +++ ipa-split.c (working copy) @@ -931,6 +931,13 @@ split_function (struct split_point *spli if (!VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) { retval = DECL_RESULT (current_function_decl); + + /* We use temporary register to hold value when aggregate_value_p + is false. Similarly for DECL_BY_REFERENCE we must avoid extra + copy. */ + if (!aggregate_value_p (retval, TREE_TYPE (current_function_decl)) + && !DECL_BY_REFERENCE (retval)) + retval = create_tmp_reg (TREE_TYPE (retval), NULL); if (is_gimple_reg (retval)) retval = make_ssa_name (retval, call); gimple_call_set_lhs (call, retval);