Message ID | 20100630121448.GJ6233@kam.mff.cuni.cz |
---|---|
State | New |
Headers | show |
On Wed, 30 Jun 2010, Jan Hubicka wrote: > 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? Ok. Thanks, Richard. > 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); > >
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);