This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: optimization/10315: [3.2/3.3 regression] [powerpc] ICE: in extract_insn, at recog.c:2175


On Wed, Apr 23, 2003 at 03:50:43PM -0700, Richard Henderson wrote:
> This is the same as PR8300, which I am looking at today.

Well, not quite the same.  There are a couple of bugs here, any one
of which will fix the crash.

First, rs6000_emit_move decided that any time it was called with a
non-general_operand input, that it must be reload doing something
weird.  The attached patch (which has only been cross-tested vs the
pr test case) would appear to do the right thing.  Would someone 
please give this proper bootstrap testing?

Second, gen_move_insn doesn't have nearly the sort of checks
performed by emit_move_insn.  This is certainly a bug.  IMO
gen_move_insn should be implemented as

	rtx gen_move_insn (dst, src)
	{
	  start_sequence ();
	  emit_move_insn (dst, src);
	  ret = get_insns ();
	  end_sequence ();
	  return ret;
	}

However, I'm sure this will break something, though I don't
know what.  Certainly we should explore something like this
for mainline, but ...


r~



	* config/rs6000/rs6000.c (rs6000_emit_move): Only elide proper
	checks during reload; use validize_mem instead of adjust_address.

Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.403.2.6
diff -c -p -d -r1.403.2.6 rs6000.c
*** config/rs6000/rs6000.c	1 Apr 2003 10:14:13 -0000	1.403.2.6
--- config/rs6000/rs6000.c	24 Apr 2003 04:42:11 -0000
*************** rs6000_emit_move (dest, source, mode)
*** 2640,2655 ****
  	}
      }
  
!   /* Handle the case where reload calls us with an invalid address;
!      and the case of CONSTANT_P_RTX.  */
!   if (!ALTIVEC_VECTOR_MODE (mode)
        && (! general_operand (operands[1], mode)
! 	  || ! nonimmediate_operand (operands[0], mode)
! 	  || GET_CODE (operands[1]) == CONSTANT_P_RTX))
!     {
!       emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
!       return;
!     }
    
    /* FIXME:  In the long term, this switch statement should go away
       and be replaced by a sequence of tests based on things like
--- 2640,2654 ----
  	}
      }
  
!   /* Handle the case where reload calls us with an invalid address.  */
!   if (reload_in_progress && mode == Pmode
        && (! general_operand (operands[1], mode)
! 	  || ! nonimmediate_operand (operands[0], mode)))
!     goto emit_set;
! 
!   /* Handle the case of CONSTANT_P_RTX.  */
!   if (GET_CODE (operands[1]) == CONSTANT_P_RTX)
!     goto emit_set;
    
    /* FIXME:  In the long term, this switch statement should go away
       and be replaced by a sequence of tests based on things like
*************** rs6000_emit_move (dest, source, mode)
*** 2864,2876 ****
    /* Above, we may have called force_const_mem which may have returned
       an invalid address.  If we can, fix this up; otherwise, reload will
       have to deal with it.  */
!   if (GET_CODE (operands[1]) == MEM
!       && ! memory_address_p (mode, XEXP (operands[1], 0))
!       && ! reload_in_progress)
!     operands[1] = adjust_address (operands[1], mode, 0);
  
    emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
-   return;
  }
  
  /* Initialize a variable CUM of type CUMULATIVE_ARGS
--- 2863,2873 ----
    /* Above, we may have called force_const_mem which may have returned
       an invalid address.  If we can, fix this up; otherwise, reload will
       have to deal with it.  */
!   if (GET_CODE (operands[1]) == MEM && ! reload_in_progress)
!     operands[1] = validize_mem (operands[1]);
  
+  emit_set:
    emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
  }
  
  /* Initialize a variable CUM of type CUMULATIVE_ARGS


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]