Commit b38e86dd by Kewen Lin

Fix typo and avoid possible memory leak in average_num_loop_insns

Function average_num_loop_insns forgets to free loop body in early
return.  Besides, overflow comparison checks 1000000 (e6) but the
return value is 100000 (e5), fix this typo.

gcc/ChangeLog

2020-01-14  Kewen Lin  <linkw@gcc.gnu.org>

    * cfgloopanal.c (average_num_loop_insns): Free bbs when early
    return, fix typo on return value.
parent edabbec3
2020-01-14 Kewen Lin <linkw@gcc.gnu.org>
* cfgloopanal.c (average_num_loop_insns): Free bbs when early return,
fix typo on return value.
2020-01-14 Xiong Hu Luo <luoxhu@linux.ibm.com>
PR ipa/69678
......
......@@ -219,7 +219,10 @@ average_num_loop_insns (const class loop *loop)
ninsns += (sreal)binsns * bb->count.to_sreal_scale (loop->header->count);
/* Avoid overflows. */
if (ninsns > 1000000)
return 100000;
{
free (bbs);
return 1000000;
}
}
free (bbs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment