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]

fix spec2000 gcc test missoptimization



Hi,
this patch fixes spec2000 gcc misscompilation.  The loop optimizer wasn't very
curefull about finding barrier assuming that it is the next insn after jump.

This is not true (and it wasn't true even with the old jump, where jump insn
and barrier has been commonly separated by note and multiple barriers also
appeared, but more rarely than they do now).

It attempted to move code outside loop and create fallthru edge, but sometimes
forgot the barrier in a way.

The patch modifies it to look curefull for latest barrier and move the whole
insn block.

I don't simply move everything until next label, as it may confuse LOOP_BEG and similar notes.

Bootstrap on i686 passed, regtesting in progress, testing also sparc

OK assuming it passes?

Honza

St čec 25 23:16:14 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* loop.c (find_and_verify_loops): Grok multiple barriers.
*** loop.c.old	Wed Jul 25 23:15:44 2001
--- loop.c	Wed Jul 25 23:15:50 2001
*************** find_and_verify_loops (f, loops)
*** 2676,2681 ****
--- 2676,2689 ----
  		  = JUMP_LABEL (insn) ? JUMP_LABEL (insn) : get_last_insn ();
  		struct loop *target_loop = uid_loop[INSN_UID (target)];
  		rtx loc, loc2;
+ 		rtx tmp;
+ 
+ 		/* Search for possible garbage past the conditional jumps
+ 		   and look for latest barrier.  */
+ 		for (tmp = last_insn_to_move;
+ 		     tmp && GET_CODE (tmp) != CODE_LABEL; tmp = NEXT_INSN (tmp))
+ 		  if (GET_CODE (tmp) == BARRIER)
+ 		    last_insn_to_move = tmp;
  
  		for (loc = target; loc; loc = PREV_INSN (loc))
  		  if (GET_CODE (loc) == BARRIER


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