This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[PATCH] More senseful loop size function


Hello,

I am currently counting all insns including notes as size of loop;
this does not make much sense and it also causes a big difference
between how PARAM_MAX_UNROLLED_INSNS is understood in old and new loop
unroller. This patch makes it more sane by counting only real insns.

It of course causes the loops to be unrolled more, and the sizes of
binaries grow by about 5-10% (so now the sizes of binaries with the old and
new unroller are simmilar). The effects on performance are not
significant (specint went a bit down, specfp a bit up, reflecting the
fact that specint binaries are larger).

Zdenek

Changelog:
	* cfgloopanal.c (num_loop_insns, average_num_loop_insns):
	Count only real insns.

Index: cfgloopanal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloopanal.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 cfgloopanal.c
*** cfgloopanal.c	8 Mar 2003 01:38:24 -0000	1.4
--- cfgloopanal.c	9 May 2003 18:27:45 -0000
*************** num_loop_insns (loop)
*** 1033,1039 ****
        bb = bbs[i];
        ninsns++;
        for (insn = bb->head; insn != bb->end; insn = NEXT_INSN (insn))
! 	ninsns++;
      }
    free(bbs);
    
--- 1033,1040 ----
        bb = bbs[i];
        ninsns++;
        for (insn = bb->head; insn != bb->end; insn = NEXT_INSN (insn))
! 	if (INSN_P (insn))
! 	  ninsns++;
      }
    free(bbs);
    
*************** average_num_loop_insns (loop)
*** 1057,1063 ****
  
        binsns = 1;
        for (insn = bb->head; insn != bb->end; insn = NEXT_INSN (insn))
! 	binsns++;
  
        ratio = loop->header->frequency == 0
  	      ? BB_FREQ_MAX
--- 1058,1065 ----
  
        binsns = 1;
        for (insn = bb->head; insn != bb->end; insn = NEXT_INSN (insn))
! 	if (INSN_P (insn))
! 	  binsns++;
  
        ratio = loop->header->frequency == 0
  	      ? BB_FREQ_MAX


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