combine: Fix problem with RTL checking

Message ID 3a6b06fcc73987f8a544b13a382aad21df2d097e.1518737408.git.segher@kernel.crashing.org
State New
Headers show
Series
  • combine: Fix problem with RTL checking
Related show

Commit Message

Segher Boessenkool Feb. 16, 2018, 1:53 p.m.
As Jakub found, after my recent combine patch at least on x86 problems
show up with RTL checking enabled.  This is because the I2 generated
by a successful instruction combination can write not only a register
but it can also write a paradoxical subreg of one.

This fixes it.

Tested on powerpc64-linux {-m64,-m32} and on x86_64-linux {-m64,-m32},
with --enable-checking=yes,rtl.  Committing it now.


Segher


2018-02-16  Segher Boessenkool  <segher@kernel.crashing.org>

	* combine.c (try_combine): When adjusting LOG_LINKS for the destination
	that moved to I2, also allow destinations that are a paradoxical
	subreg (instead of a normal reg).

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

-- 
1.8.3.1

Patch

diff --git a/gcc/combine.c b/gcc/combine.c
index c386f3a..cd4aaa4 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -4379,7 +4379,12 @@ 
       if (GET_CODE (x) == PARALLEL)
 	x = XVECEXP (newi2pat, 0, 0);
 
-      unsigned int regno = REGNO (SET_DEST (x));
+      /* It can only be a SET of a REG or of a paradoxical SUBREG of a REG.  */
+      x = SET_DEST (x);
+      if (paradoxical_subreg_p (x))
+	x = SUBREG_REG (x);
+
+      unsigned int regno = REGNO (x);
 
       bool done = false;
       for (rtx_insn *insn = NEXT_INSN (i3);