diff mbox

: Update bb->count to avoid erroneous partitioning decisions

Message ID 509A450A.304@st.com
State New
Headers show

Commit Message

Christian Bruel Nov. 7, 2012, 11:24 a.m. UTC
Hello,

This tiny patch fixes the issue previously discussed in
http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00794.html

Not maintaining bb->count while merging basic blocs results in wrong
partitioning (and surely other) decisions. This is visible on the SH4
with shrink-wrapping. I haven't noticed any difference on x86.

This also solves a few "Invalid sum of incoming frequencies" messages
while dumping the CFG

Reg-tested on x85 and sh-superh-elf. Is it OK for the 4.7 and 4.8 branches ?

Thanks

Christian

Comments

Jan Hubicka Nov. 7, 2012, 11:29 a.m. UTC | #1
> Hello,
> 
> This tiny patch fixes the issue previously discussed in
> http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00794.html
> 
> Not maintaining bb->count while merging basic blocs results in wrong
> partitioning (and surely other) decisions. This is visible on the SH4
> with shrink-wrapping. I haven't noticed any difference on x86.
> 
> This also solves a few "Invalid sum of incoming frequencies" messages
> while dumping the CFG
> 
> Reg-tested on x85 and sh-superh-elf. Is it OK for the 4.7 and 4.8 branches ?
> 
> Thanks
> 
> Christian

> 2012-11-07  Christian Bruel  <christian.bruel@st.com>
> 
> 	* tree-ssa-tail-merge.c (replace_block_by): Update target bb count.
> 
> Index: tree-ssa-tail-merge.c
> ===================================================================
> --- tree-ssa-tail-merge.c	(revision 193283)
> +++ tree-ssa-tail-merge.c	(working copy)
> @@ -1490,6 +1490,8 @@ replace_block_by (basic_block bb1, basic_block bb2
>      bb2->frequency = BB_FREQ_MAX;
>    bb1->frequency = 0;
>  
> +  bb2->count += bb1->count;
> +
OK,
is bb1 going to die?  If not, probably bb1->count = 0 should be there, if so,
then the bb1->frequency = 0 is redundant.

honza
>    /* Do updates that use bb1, before deleting bb1.  */
>    release_last_vdef (bb1);
>    same_succ_flush_bb (bb1);
diff mbox

Patch

2012-11-07  Christian Bruel  <christian.bruel@st.com>

	* tree-ssa-tail-merge.c (replace_block_by): Update target bb count.

Index: tree-ssa-tail-merge.c
===================================================================
--- tree-ssa-tail-merge.c	(revision 193283)
+++ tree-ssa-tail-merge.c	(working copy)
@@ -1490,6 +1490,8 @@  replace_block_by (basic_block bb1, basic_block bb2
     bb2->frequency = BB_FREQ_MAX;
   bb1->frequency = 0;
 
+  bb2->count += bb1->count;
+
   /* Do updates that use bb1, before deleting bb1.  */
   release_last_vdef (bb1);
   same_succ_flush_bb (bb1);