diff mbox

Don't perform the REGNO != REGNO REE for modes other than scalar integral (PR rtl-optimization/59754)

Message ID 20140110204522.GI892@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 10, 2014, 8:45 p.m. UTC
Hi!

The new REGNO != REGNO optimization assumes that a lowpart subreg of
the extended reg will be the value of the original expression.
But that is the case of only scalar integral modes, e.g. for vector
mode extensions a lowpart subreg will occupy just say half or even fewer
vector elements, but in the extended element values instead of original.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
and eyeballed the testcase for AVX512F from the testsuite.  Ok for trunk?

2014-01-10  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/59754
	* ree.c (combine_reaching_defs): Disallow !SCALAR_INT_MODE_P
	modes in the REGNO != REGNO case.


	Jakub

Comments

Jeff Law Jan. 10, 2014, 9:18 p.m. UTC | #1
On 01/10/14 13:45, Jakub Jelinek wrote:
> Hi!
>
> The new REGNO != REGNO optimization assumes that a lowpart subreg of
> the extended reg will be the value of the original expression.
> But that is the case of only scalar integral modes, e.g. for vector
> mode extensions a lowpart subreg will occupy just say half or even fewer
> vector elements, but in the extended element values instead of original.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> and eyeballed the testcase for AVX512F from the testsuite.  Ok for trunk?
>
> 2014-01-10  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR rtl-optimization/59754
> 	* ree.c (combine_reaching_defs): Disallow !SCALAR_INT_MODE_P
> 	modes in the REGNO != REGNO case.
Yes, this is fine.  Thanks for taking care of it, my testing boxes are 
busy testing the other two queued ree things.

jeff
diff mbox

Patch

--- gcc/ree.c.jj	2014-01-09 08:19:39.000000000 +0100
+++ gcc/ree.c	2014-01-10 13:51:14.216730694 +0100
@@ -702,6 +702,18 @@  combine_reaching_defs (ext_cand *cand, c
       if (state->modified[INSN_UID (cand->insn)].kind != EXT_MODIFIED_NONE)
 	return false;
 
+      /* Transformation of
+	 (set (reg1) (expression))
+	 (set (reg2) (any_extend (reg1)))
+	 into
+	 (set (reg2) (any_extend (expression)))
+	 (set (reg1) (reg2))
+	 is only valid for scalar integral modes, as it relies on the low
+	 subreg of reg1 to have the value of (expression), which is not true
+	 e.g. for vector modes.  */
+      if (!SCALAR_INT_MODE_P (GET_MODE (SET_DEST (PATTERN (cand->insn)))))
+	return false;
+
       /* There's only one reaching def.  */
       rtx def_insn = state->defs_list[0];