cse.c bug?

John Carr jfc@mit.edu
Sun Feb 1 12:59:00 GMT 1998


I think there is a bug in the CSE code to scan skipped blocks.  It's
been about 5 years since I worked on this code and I can't remember
why invalidate_skipped_set ignores CLOBBERs, but I found a case where
it shouldn't.

On SPARC, in a sequence like
	set cc
	branch on cc
	label
	clobber cc
	set cc
	branch on cc

the second compare was being eliminated even though the CC was no
longer valid.  The clobber was in a PARALLEL.

Can anyone see where CLOBBER in a skipped block is supposed to be
handled?  If not, I suggest this patch.


Sun Feb  1 15:26:40 1998  John Carr  <jfc@mit.edu>

	* cse.c (invalidate_skipped_set): Don't ignore CLOBBERs.

*** cse.c~	Sun Feb  1 10:36:11 1998
--- cse.c	Sun Feb  1 15:25:25 1998
***************
*** 7844,7851 ****
      }
  }
  
! /* Process one SET of an insn that was skipped.  We ignore CLOBBERs
!    since they are done elsewhere.  This function is called via note_stores.  */
  
  static void
  invalidate_skipped_set (dest, set)
--- 7844,7851 ----
      }
  }
  
! /* Process one SET of an insn that was skipped.  This function is called
!    via note_stores.  */
  
  static void
  invalidate_skipped_set (dest, set)
***************
*** 7868,7878 ****
        return;
      }
  
!   if (GET_CODE (set) == CLOBBER
  #ifdef HAVE_cc0
        || dest == cc0_rtx
  #endif
!       || dest == pc_rtx)
      return;
  
    if (code == STRICT_LOW_PART || code == ZERO_EXTRACT)
--- 7868,7878 ----
        return;
      }
  
!   if (dest == pc_rtx
  #ifdef HAVE_cc0
        || dest == cc0_rtx
  #endif
!       )
      return;
  
    if (code == STRICT_LOW_PART || code == ZERO_EXTRACT)



More information about the Gcc mailing list