diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-30 09:57:56 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-30 09:57:56 +0000 |
commit | 47c3d424ba3322728c44368b979fcdde2597f585 (patch) | |
tree | 4e22c3671349439e180deee055e799d2e1c28b03 /gcc/cfgloopanal.c | |
parent | 6f88e480cd712d469d86e32f2f2b178ec5702be9 (diff) | |
download | gcc-47c3d424ba3322728c44368b979fcdde2597f585.tar.gz |
PR target/41279
* cfgloopanal.c (num_loop_insns): Don't increment ninsns for each bb
before insn counting loop now that BB_END (bb) is counted. Ensure
the return value isn't zero.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152324 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopanal.c')
-rw-r--r-- | gcc/cfgloopanal.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 33aff6dbceb..129ec25a331 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -175,12 +175,14 @@ 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 (NONDEBUG_INSN_P (insn)) ninsns++; } - free(bbs); + free (bbs); + + if (!ninsns) + ninsns = 1; /* To avoid division by zero. */ return ninsns; } @@ -209,7 +211,7 @@ average_num_loop_insns (const struct loop *loop) : (bb->frequency * BB_FREQ_MAX) / loop->header->frequency; ninsns += binsns * ratio; } - free(bbs); + free (bbs); ninsns /= BB_FREQ_MAX; if (!ninsns) |