This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta] don't count debug insns in loops
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 05 Nov 2007 06:22:53 -0200
- Subject: [vta] don't count debug insns in loops
RTL loop optimizations that count insns to make decisions must not
take debug insns into account, lest codegen changes will result.
Fixed thusly. Will install in vta shortly.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* cfgloopanal.c (num_loop_insns): Don't count debug insn.
(average_num_loop_insns): Likewise.
Index: gcc/cfgloopanal.c
===================================================================
--- gcc/cfgloopanal.c.orig 2007-09-05 04:40:01.000000000 -0300
+++ gcc/cfgloopanal.c 2007-11-01 12:07:55.000000000 -0200
@@ -173,7 +173,7 @@ num_loop_insns (const struct loop *loop)
bb = bbs[i];
ninsns++;
for (insn = BB_HEAD (bb); insn != BB_END (bb); insn = NEXT_INSN (insn))
- if (INSN_P (insn))
+ if (INSN_P (insn) && !DEBUG_INSN_P (insn))
ninsns++;
}
free(bbs);
@@ -197,7 +197,7 @@ average_num_loop_insns (const struct loo
binsns = 1;
for (insn = BB_HEAD (bb); insn != BB_END (bb); insn = NEXT_INSN (insn))
- if (INSN_P (insn))
+ if (INSN_P (insn) && !DEBUG_INSN_P (insn))
binsns++;
ratio = loop->header->frequency == 0
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}