S/390: Fix ICE in instantiate_virtual_regs

Ulrich Weigand weigand@i1.informatik.uni-erlangen.de
Sat Jan 31 17:32:00 GMT 2004


Hello,

this fixes an ICE in instantiate_virtual_regs on 3.4 on s390,
caused by the replacement of a virtual reg inside a load-address
instruction by a new pseudo.  This caused the instruction to no
longer satify the conditions used to test for a valid LA pattern.

Fixed by not allowing virtual regs inside LA patterns in the first
place; this should not really pessimize things as combine and the
peepholes are supposed to clean up again.

(Incidentally the patch also fixes a typo in one of the LA peepholes
that caused it to not trigger :-/)

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux;
applied to mainline and 3.4.

Bye,
Ulrich


ChangeLog:

	* config/s390/s390.c (s390_decompose_address): Do not treat virtual
	registers as pointers.
	* config/s390/s390.md ("*la_31" second peephole2): Fix incorrect mode.



Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.125.4.2
diff -c -p -r1.125.4.2 s390.c
*** gcc/config/s390/s390.c	28 Jan 2004 00:15:59 -0000	1.125.4.2
--- gcc/config/s390/s390.c	30 Jan 2004 16:43:34 -0000
*************** s390_decompose_address (register rtx add
*** 2072,2079 ****
  	      && frame_pointer_needed
  	      && REGNO (base) == HARD_FRAME_POINTER_REGNUM)
  	  || REGNO (base) == ARG_POINTER_REGNUM
- 	  || (REGNO (base) >= FIRST_VIRTUAL_REGISTER
- 	      && REGNO (base) <= LAST_VIRTUAL_REGISTER)
            || (flag_pic
                && REGNO (base) == PIC_OFFSET_TABLE_REGNUM))
          pointer = base_ptr = TRUE;
--- 2072,2077 ----
*************** s390_decompose_address (register rtx add
*** 2099,2106 ****
  	      && frame_pointer_needed
  	      && REGNO (indx) == HARD_FRAME_POINTER_REGNUM)
  	  || REGNO (indx) == ARG_POINTER_REGNUM
- 	  || (REGNO (indx) >= FIRST_VIRTUAL_REGISTER
- 	      && REGNO (indx) <= LAST_VIRTUAL_REGISTER)
            || (flag_pic
                && REGNO (indx) == PIC_OFFSET_TABLE_REGNUM))
          pointer = indx_ptr = TRUE;
--- 2097,2102 ----
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.90.4.1
diff -c -p -r1.90.4.1 s390.md
*** gcc/config/s390/s390.md	28 Jan 2004 00:15:59 -0000	1.90.4.1
--- gcc/config/s390/s390.md	30 Jan 2004 16:43:39 -0000
***************
*** 3615,3621 ****
     && !reg_overlap_mentioned_p (operands[0], operands[2])
     && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
     && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
!   [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
    "")
  
  (define_insn "*la_31_and"
--- 3615,3621 ----
     && !reg_overlap_mentioned_p (operands[0], operands[2])
     && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
     && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
!   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
    "")
  
  (define_insn "*la_31_and"
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de



More information about the Gcc-patches mailing list