From: Segher Boessenkool Date: Thu, 2 Oct 2014 02:18:01 +0000 (+0200) Subject: re PR rtl-optimization/62151 (wrong code at -O2 and -O3 on x86_64-linux-gnu) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fef32cf89f7fe0c8864443dca942c6e34a204976;p=gcc.git re PR rtl-optimization/62151 (wrong code at -O2 and -O3 on x86_64-linux-gnu) 2014-10-01 Segher Boessenkool gcc/ PR rtl-optimization/62151 * combine.c (can_combine_p): Allow the destination register of INSN to be clobbered in I3. (subst): Do not substitute into clobbers of registers. gcc/testsuite/ * gcc.dg/combine-clobber.c: New. From-SVN: r215789 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a59825c064..aafbd2e0486 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-10-01 Segher Boessenkool + + PR rtl-optimization/62151 + * combine.c (can_combine_p): Allow the destination register of INSN + to be clobbered in I3. + (subst): Do not substitute into clobbers of registers. + 2014-10-01 Jakub Jelinek PR debug/63342 diff --git a/gcc/combine.c b/gcc/combine.c index 1457eabadf9..ff5f0dbd509 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1950,11 +1950,7 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED, for (i = XVECLEN (PATTERN (i3), 0) - 1; i >= 0; i--) if (GET_CODE (XVECEXP (PATTERN (i3), 0, i)) == CLOBBER) { - /* Don't substitute for a register intended as a clobberable - operand. */ rtx reg = XEXP (XVECEXP (PATTERN (i3), 0, i), 0); - if (rtx_equal_p (reg, dest)) - return 0; /* If the clobber represents an earlyclobber operand, we must not substitute an expression containing the clobbered register. @@ -4963,6 +4959,11 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy) || (REG_P (X) && REG_P (Y) \ && REGNO (X) == REGNO (Y) && GET_MODE (X) == GET_MODE (Y))) + /* Do not substitute into clobbers of regs -- this will never result in + valid RTL. */ + if (GET_CODE (x) == CLOBBER && REG_P (XEXP (x, 0))) + return x; + if (! in_dest && COMBINE_RTX_EQUAL_P (x, from)) { n_occurrences++; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9936e6192ec..0cf36a08329 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-10-01 Segher Boessenkool + + * gcc.dg/combine-clobber.c: New. + 2014-10-01 Jakub Jelinek PR debug/63342