[PATCH] Don't perform the REGNO != REGNO REE for modes other than scalar integral (PR rtl-optimization/59754)
Fri Jan 10 20:45:00 GMT 2014
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 <firstname.lastname@example.org>
* ree.c (combine_reaching_defs): Disallow !SCALAR_INT_MODE_P
modes in the REGNO != REGNO case.
--- 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)
+ /* Transformation of
+ (set (reg1) (expression))
+ (set (reg2) (any_extend (reg1)))
+ (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;
More information about the Gcc-patches