Patchwork PR middle-end/PR44706 (xalancbmk ICE)

login
register
mail settings
Submitter Jan Hubicka
Date June 30, 2010, 4:53 p.m.
Message ID <20100630165342.GK6233@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/57441/
State New
Headers show

Comments

Jan Hubicka - June 30, 2010, 4:53 p.m.
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

Patch

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" } } */