public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix PR middle-end/68291 & 68292
@ 2015-12-07  9:36 Eric Botcazou
  2015-12-07 10:14 ` Bernd Schmidt
  2015-12-08  9:31 ` Christophe Lyon
  0 siblings, 2 replies; 11+ messages in thread
From: Eric Botcazou @ 2015-12-07  9:36 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

Hi,

it's a couple of regressions in the C testsuite present on SPARC 64-bit and 
coming from the new coalescing code which fails to handle vector types with 
BLKmode that are returned in multiple registers.  The code assigns a BLKmode 
REG to the RESULT_DECL of the function in expand_function_start and this later 
causes expand_function_end to choke.

As discussed with Alexandre in the audit trail, the attached minimal fix just 
prevents the problematic BLKmode REG from being generated, which appears to be 
sufficient to restore the nominal operating mode.

Tested on x86-64/Linux and SPARC64/Solaris, OK for the mainline?


2015-12-07  Eric Botcazou  <ebotcazou@adacore.com>

	PR middle-end/68291
	PR middle-end/68292
	* cfgexpand.c (set_rtl): Always accept PARALLELs with BLKmode for
	SSA names based on RESULT_DECLs.
	* function.c (expand_function_start): Do not create BLKmode REGs
	for GIMPLE registers when coalescing is enabled.

-- 
Eric Botcazou

[-- Attachment #2: pr68291.diff --]
[-- Type: text/x-patch, Size: 2094 bytes --]

Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 231318)
+++ cfgexpand.c	(working copy)
@@ -184,10 +184,15 @@ set_rtl (tree t, rtx x)
 				      || SUBREG_P (XEXP (x, 0)))
 				  && (REG_P (XEXP (x, 1))
 				      || SUBREG_P (XEXP (x, 1))))
+			      /* We need to accept PARALLELs for RESUT_DECLs
+				 because of vector types with BLKmode returned
+				 in multiple registers, but they are supposed
+				 to be uncoalesced.  */
 			      || (GET_CODE (x) == PARALLEL
 				  && SSAVAR (t)
 				  && TREE_CODE (SSAVAR (t)) == RESULT_DECL
-				  && !flag_tree_coalesce_vars))
+				  && (GET_MODE (x) == BLKmode
+				      || !flag_tree_coalesce_vars)))
 			   : (MEM_P (x) || x == pc_rtx
 			      || (GET_CODE (x) == CONCAT
 				  && MEM_P (XEXP (x, 0))
Index: function.c
===================================================================
--- function.c	(revision 231318)
+++ function.c	(working copy)
@@ -5148,15 +5148,16 @@ expand_function_start (tree subr)
       /* Compute the return values into a pseudo reg, which we will copy
 	 into the true return register after the cleanups are done.  */
       tree return_type = TREE_TYPE (res);
-      /* If we may coalesce this result, make sure it has the expected
-	 mode.  */
-      if (flag_tree_coalesce_vars && is_gimple_reg (res))
-	{
-	  tree def = ssa_default_def (cfun, res);
-	  gcc_assert (def);
-	  machine_mode mode = promote_ssa_mode (def, NULL);
-	  set_parm_rtl (res, gen_reg_rtx (mode));
-	}
+
+      /* If we may coalesce this result, make sure it has the expected mode
+	 in case it was promoted.  But we need not bother about BLKmode.  */
+      machine_mode promoted_mode
+	= flag_tree_coalesce_vars && is_gimple_reg (res)
+	  ? promote_ssa_mode (ssa_default_def (cfun, res), NULL)
+	  : BLKmode;
+
+      if (promoted_mode != BLKmode)
+	set_parm_rtl (res, gen_reg_rtx (promoted_mode));
       else if (TYPE_MODE (return_type) != BLKmode
 	       && targetm.calls.return_in_msb (return_type))
 	/* expand_function_end will insert the appropriate padding in

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-12-09  9:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07  9:36 [patch] Fix PR middle-end/68291 & 68292 Eric Botcazou
2015-12-07 10:14 ` Bernd Schmidt
2015-12-07 16:42   ` Eric Botcazou
2015-12-07 17:01     ` Richard Biener
2015-12-08  9:31 ` Christophe Lyon
2015-12-08  9:46   ` Eric Botcazou
2015-12-08 10:05     ` Christophe Lyon
2015-12-08 10:50       ` Eric Botcazou
2015-12-08 15:40         ` Bernd Schmidt
2015-12-08 18:48           ` Eric Botcazou
2015-12-09  9:11             ` Christophe Lyon

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).