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]

[vta] ensure num_loop_insns does not return zero

num_loop_insns() used to not count the BB_END, and increment ninsns
once per block.  I changed it back in July to avoid differences caused
by debug insns at the end of a block, but this caused some testsuite
regressions (division by zero) for loops that contained only debug
insns.  Oops.

Fixed as follows.

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <>

	* cfgloopanal.c (num_loop_insns): Ensure ninsns is never zero.

Index: gcc/cfgloopanal.c
--- gcc/cfgloopanal.c.orig	2008-10-10 09:31:05.000000000 -0300
+++ gcc/cfgloopanal.c	2008-11-17 15:28:26.000000000 -0200
@@ -173,7 +173,7 @@ num_loop_insns (const struct loop *loop)
   for (i = 0; i < loop->num_nodes; i++)
       bb = bbs[i];
+      ninsns++;
       FOR_BB_INSNS (bb, insn)
 	if (INSN_P (insn) && !DEBUG_INSN_P (insn))
Alexandre Oliva 
You must be the change you wish to see in the world. -- Gandhi
Be Free! --   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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