This is the mail archive of the 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]

PATCH: Properly check the end of basic block


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?


2010-11-16  H.J. Lu  <>

	* 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))

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