* PR middle-end/PR44706 (xalancbmk ICE)
@ 2010-06-30 13:53 Jan Hubicka
2010-06-30 14:07 ` Richard Guenther
0 siblings, 1 reply; 3+ messages in thread
From: Jan Hubicka @ 2010-06-30 13:53 UTC (permalink / raw)
To: gcc-patches, rguenther
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PR middle-end/PR44706 (xalancbmk ICE)
2010-06-30 13:53 PR middle-end/PR44706 (xalancbmk ICE) Jan Hubicka
@ 2010-06-30 14:07 ` Richard Guenther
2010-06-30 17:23 ` Jan Hubicka
0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2010-06-30 14:07 UTC (permalink / raw)
To: Jan Hubicka; +Cc: gcc-patches
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);
>
>
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PR middle-end/PR44706 (xalancbmk ICE)
2010-06-30 14:07 ` Richard Guenther
@ 2010-06-30 17:23 ` Jan Hubicka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Hubicka @ 2010-06-30 17:23 UTC (permalink / raw)
To: Richard Guenther; +Cc: Jan Hubicka, gcc-patches
Hi,
since the testcase also shows branch prediction bug that I am testing patch for
and that makes the testcase useless to test this particular code path, I decided
to make artificial one for this patch.
I will commit the xalanbmk one with the followup patch fixing the profile.
This is variant of patch I comitted.
Honza
Index: ChangeLog
===================================================================
--- ChangeLog (revision 161614)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2010-06-30 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/PR44706
+ * ipa-split (split_function): Refine conditions when to use DECL_RESULT
+ to return the value.
+
2010-06-30 Michael Matz <matz@suse.de>
PR bootstrap/44699
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: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 161614)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2010-06-30 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/ipa-split-4.c: New testcase.
+
2010-06-30 Michael Matz <matz@suse.de>
PR bootstrap/44699
Index: testsuite/gcc.dg/tree-ssa/ipa-split-4.c
===================================================================
--- testsuite/gcc.dg/tree-ssa/ipa-split-4.c (revision 0)
+++ testsuite/gcc.dg/tree-ssa/ipa-split-4.c (revision 0)
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-fnsplit" } */
+int make_me_big (void);
+
+int
+split_me (int a)
+{
+ if (__builtin_expect(a<10, 1))
+ {
+ abort ();
+ }
+ else
+ {
+ make_me_big ();
+ make_me_big ();
+ make_me_big ();
+ make_me_big ();
+ return a+1;
+ }
+}
+
+main()
+{
+ return split_me (0)+split_me(1)+split_me(2);
+}
+/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */
+/* { dg-final { cleanup-tree-dump "fnsplit" } } */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-30 16:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30 13:53 PR middle-end/PR44706 (xalancbmk ICE) Jan Hubicka
2010-06-30 14:07 ` Richard Guenther
2010-06-30 17:23 ` Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).