Fix IA-64 bootstrap failure

Jan Hubicka jh@suse.cz
Mon Feb 2 20:31:00 GMT 2004


> 
> Right.  Thanks for noticing it!
> Since you went trought the fixing the issue too, can you please try to
> verify my reasioning in the mail?  I am not at all sure about it, but it
> seems to make sense to me.
> Still i am not sure whether your patch shall not produce better code
> than mine, then we shall go with it of course.

Hi,
to make review easier, here is updated version of patch.  I would really
like to see it accepted for mainline/branch so the IA-64 bootstrap works
again and I can try to ask Mark for aproving CSElib patches for mainline

I've re-tested the patch on current tree and also verified that it does
not affect code generated for IA-64 on combine.c.

Honza

2004-02-02  Jan Hubicka  <jh@suse.cz>

	* alias.c (find_base_term, get_addr):  Do not dereference NULL
	pointer when all VALUE's locations has been invalidated.
	(rtx_equal_for_memref_p): Simplify checking of VALUEs.

Index: alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/alias.c,v
retrieving revision 1.213
diff -c -3 -p -r1.213 alias.c
*** alias.c	2 Feb 2004 00:17:08 -0000	1.213
--- alias.c	2 Feb 2004 20:27:46 -0000
*************** rtx_equal_for_memref_p (rtx x, rtx y)
*** 1139,1147 ****
    /* Some RTL can be compared without a recursive examination.  */
    switch (code)
      {
-     case VALUE:
-       return CSELIB_VAL_PTR (x) == CSELIB_VAL_PTR (y);
- 
      case REG:
        return REGNO (x) == REGNO (y);
  
--- 1139,1144 ----
*************** rtx_equal_for_memref_p (rtx x, rtx y)
*** 1151,1156 ****
--- 1148,1154 ----
      case SYMBOL_REF:
        return XSTR (x, 0) == XSTR (y, 0);
  
+     case VALUE:
      case CONST_INT:
      case CONST_DOUBLE:
        /* There's no need to compare the contents of CONST_DOUBLEs or
*************** find_base_term (rtx x)
*** 1325,1330 ****
--- 1323,1330 ----
  
      case VALUE:
        val = CSELIB_VAL_PTR (x);
+       if (!val)
+ 	return 0;
        for (l = val->locs; l; l = l->next)
  	if ((x = find_base_term (l->loc)) != 0)
  	  return x;
*************** get_addr (rtx x)
*** 1502,1515 ****
    if (GET_CODE (x) != VALUE)
      return x;
    v = CSELIB_VAL_PTR (x);
!   for (l = v->locs; l; l = l->next)
!     if (CONSTANT_P (l->loc))
!       return l->loc;
!   for (l = v->locs; l; l = l->next)
!     if (GET_CODE (l->loc) != REG && GET_CODE (l->loc) != MEM)
!       return l->loc;
!   if (v->locs)
!     return v->locs->loc;
    return x;
  }
  
--- 1502,1518 ----
    if (GET_CODE (x) != VALUE)
      return x;
    v = CSELIB_VAL_PTR (x);
!   if (v)
!     {
!       for (l = v->locs; l; l = l->next)
! 	if (CONSTANT_P (l->loc))
! 	  return l->loc;
!       for (l = v->locs; l; l = l->next)
! 	if (GET_CODE (l->loc) != REG && GET_CODE (l->loc) != MEM)
! 	  return l->loc;
!       if (v->locs)
! 	return v->locs->loc;
!     }
    return x;
  }
  



More information about the Gcc-patches mailing list