[Bug c/40093] New: Optimization by functios reordering.

vvv at ru dot ru gcc-bugzilla@gcc.gnu.org
Sun May 10 16:39:00 GMT 2009


Because memory controller prefetch memory blocks, execution time of functions
calls sequence depend on order this functions in memory. For example:
4 calls:

call func1
call func2
call func3
call func4

faster in case of direct functions order in memmory:
.p2align 4
func1:
      ret
.p2align 4
func2:
      ret
.p2align 4
func3:
      ret
.p2align 4
func4:
      ret

and slow in case inverse order:
.p2align 4
func4:
      ret
.p2align 4
func3:
      ret
.p2align 4
func2:
      ret
.p2align 4
func1:
      ret

Unfortunately, inverse order is typical for C/C++.
what do you think about this kind optimization?


-- 
           Summary: Optimization by functios reordering.
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vvv at ru dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40093



More information about the Gcc-bugs mailing list