public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Properly check the end of basic block
@ 2010-11-17  8:34 H.J. Lu
  2010-11-17  9:24 ` Uros Bizjak
  0 siblings, 1 reply; 26+ messages in thread
From: H.J. Lu @ 2010-11-17  8:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: Uros Bizjak

Hi,

We may have

insn != BB_END (bb) && NEXT_INSN (insn) == NEXT_INSN (BB_END (bb))

We should check NEXT_INSN (insn) != NEXT_INSN (BB_END (bb)) in
move_or_delete_vzeroupper_2.  This patch does it.

OK for trunk?

Thanks.


H.J.
----
2010-11-16  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (move_or_delete_vzeroupper_2): Properly
	check the end of basic block.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e52f9b2..704a67d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -108,7 +108,7 @@ check_avx256_stores (rtx dest, const_rtx set, void *data)
 static void
 move_or_delete_vzeroupper_2 (basic_block bb, bool upper_128bits_set)
 {
-  rtx insn;
+  rtx insn, last;
   rtx vzeroupper_insn = NULL_RTX;
   rtx pat;
   int avx256;
@@ -118,9 +118,12 @@ move_or_delete_vzeroupper_2 (basic_block bb, bool upper_128bits_set)
 	     bb->index, upper_128bits_set);
 
   insn = BB_HEAD (bb);
+  last = NEXT_INSN (BB_END (bb));
   while (insn != BB_END (bb))
     {
       insn = NEXT_INSN (insn);
+      if (insn == last)
+	break;
 
       if (!NONDEBUG_INSN_P (insn))
 	continue;

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: PATCH: Properly check the end of basic block
@ 2010-11-18 23:09 Steven Bosscher
  2010-11-18 23:37 ` Uros Bizjak
  2010-11-23 12:42 ` Richard Sandiford
  0 siblings, 2 replies; 26+ messages in thread
From: Steven Bosscher @ 2010-11-18 23:09 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: H.J. Lu, gcc-patches, Jan Hubicka, Richard Henderson

> Index: passes.c
> ===================================================================
> --- passes.c	(revision 166920)
> +++ passes.c	(working copy)
> @@ -1051,8 +1051,8 @@ init_optimization_passes (void)
>  	  NEXT_PASS (pass_compute_alignments);
>  	  NEXT_PASS (pass_duplicate_computed_gotos);
>  	  NEXT_PASS (pass_variable_tracking);
> -	  NEXT_PASS (pass_free_cfg);
>  	  NEXT_PASS (pass_machine_reorg);
> +	  NEXT_PASS (pass_free_cfg);
>  	  NEXT_PASS (pass_cleanup_barriers);
>  	  NEXT_PASS (pass_delay_slots);
>  	  NEXT_PASS (pass_split_for_shorten_branches);

This breaks at least all targets that run delay slot scheduling during
machine-reorg (MIPS), targets that layout constant pools (SH,ARM),
targets that recompute the CFG in their machine-reorg (blackfin, ia64,
MIPS (?!)).

But I'm impressed that an ix86 bootstrap survives with this patch.
Have you verified that there are no changes in the generated code?

Ciao!
Steven

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2010-11-23 12:06 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-17  8:34 PATCH: Properly check the end of basic block H.J. Lu
2010-11-17  9:24 ` Uros Bizjak
2010-11-17 15:21   ` H.J. Lu
2010-11-17 20:26     ` Uros Bizjak
2010-11-18  0:49       ` H.J. Lu
2010-11-18  7:06         ` H.J. Lu
2010-11-18  9:23         ` Uros Bizjak
2010-11-18 10:47         ` Uros Bizjak
2010-11-18 18:38   ` H.J. Lu
2010-11-18 19:27     ` Uros Bizjak
2010-11-18 19:51       ` H.J. Lu
2010-11-18 20:25         ` Uros Bizjak
2010-11-18 20:44           ` H.J. Lu
2010-11-18 22:30           ` Uros Bizjak
2010-11-18 22:33             ` Andrew Pinski
2010-11-18 22:36             ` Jakub Jelinek
2010-11-18 22:55               ` Uros Bizjak
2010-11-18 22:50             ` Richard Henderson
2010-11-18 23:48               ` Uros Bizjak
2010-11-19  0:56                 ` Richard Henderson
2010-11-19  1:15                   ` Uros Bizjak
2010-11-19  9:56             ` Jan Hubicka
2010-11-18 23:09 Steven Bosscher
2010-11-18 23:37 ` Uros Bizjak
2010-11-23 12:42 ` Richard Sandiford
2010-11-23 13:28   ` Steven Bosscher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).