diff mbox

combine: Do not allow asm as I2 in a special case

Message ID 57fc8b78d95beca67e0f4146ea117aee4bf316dd.1418240878.git.segher@kernel.crashing.org
State New
Headers show

Commit Message

Segher Boessenkool Dec. 10, 2014, 8:12 p.m. UTC
My rs6000 patch putting a clobber of the carry in every asm regressed
guality/pr41353-1.c.  This is because the asm (in f3 in that testcase,
for example) now is a PARALLEL, and the special case for I2 a parallel
and I3 a register move now triggers.  Before, when the asm was not a
parallel, can_combine_p disallowed combining I2.  The effect of the
change is that some debug info becomes invalid and is deleted later,
causing the testsuite regression.

Let's not allow combining an asm in this special case either.

Bootstrapped and tested on powerpc64-linux; okay for mainline?


Segher


2014-12-10  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/
	* combine.c (try_combine): Do not allow combining a PARALLEL I2
	with a register move I3 if that I2 is an asm.

Comments

Jeff Law Dec. 10, 2014, 10:57 p.m. UTC | #1
On 12/10/14 13:12, Segher Boessenkool wrote:
> My rs6000 patch putting a clobber of the carry in every asm regressed
> guality/pr41353-1.c.  This is because the asm (in f3 in that testcase,
> for example) now is a PARALLEL, and the special case for I2 a parallel
> and I3 a register move now triggers.  Before, when the asm was not a
> parallel, can_combine_p disallowed combining I2.  The effect of the
> change is that some debug info becomes invalid and is deleted later,
> causing the testsuite regression.
>
> Let's not allow combining an asm in this special case either.
>
> Bootstrapped and tested on powerpc64-linux; okay for mainline?
>
>
> Segher
>
>
> 2014-12-10  Segher Boessenkool  <segher@kernel.crashing.org>
>
> gcc/
> 	* combine.c (try_combine): Do not allow combining a PARALLEL I2
> 	with a register move I3 if that I2 is an asm.
OK.
jeff
diff mbox

Patch

diff --git a/gcc/combine.c b/gcc/combine.c
index f5ade9e..8995c1d3 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2748,6 +2748,13 @@  try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 					SET_DEST (XVECEXP (p2, 0, i))))
 	  break;
 
+      /* Make sure this PARALLEL is not an asm.  We do not allow combining
+	 that usually (see can_combine_p), so do not here either.  */
+      for (i = 0; i < XVECLEN (p2, 0); i++)
+	if (GET_CODE (XVECEXP (p2, 0, i)) == SET
+	    && GET_CODE (SET_SRC (XVECEXP (p2, 0, i))) == ASM_OPERANDS)
+	  break;
+
       if (i == XVECLEN (p2, 0))
 	for (i = 0; i < XVECLEN (p2, 0); i++)
 	  if (GET_CODE (XVECEXP (p2, 0, i)) == SET
-- 
1.8.1.4


---
 gcc/combine.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/combine.c b/gcc/combine.c
index f5ade9e..8995c1d3 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2748,6 +2748,13 @@  try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 					SET_DEST (XVECEXP (p2, 0, i))))
 	  break;
 
+      /* Make sure this PARALLEL is not an asm.  We do not allow combining
+	 that usually (see can_combine_p), so do not here either.  */
+      for (i = 0; i < XVECLEN (p2, 0); i++)
+	if (GET_CODE (XVECEXP (p2, 0, i)) == SET
+	    && GET_CODE (SET_SRC (XVECEXP (p2, 0, i))) == ASM_OPERANDS)
+	  break;
+
       if (i == XVECLEN (p2, 0))
 	for (i = 0; i < XVECLEN (p2, 0); i++)
 	  if (GET_CODE (XVECEXP (p2, 0, i)) == SET