Skip to main content

Aggressive Function Inlining with Global Code Reordering

Code reordering and function inlining are commonly used today for improving memory locality and eliminating memory accesses. In this paper we present a new profile based optimization of an aggressive function inlining, based on a study of the mutual effects between code reordering and inlined functions. The proposed optimization duplicates frequently executed large functions and replaces their function calls by their bodies, while removing corresponding call and return instructions at the call sites. The inlining step is then followed by global code reordering to achieve better grouping of frequently executed code across function calls. The aggressiveness of the function inlining relies on the fact that no constrains are applied on the size, or the number, of the functions being inlined - only execution frequency is taken into consideration during the inlining process. The global code reordering that follows the function inlining guarantees the separation between cold and hot segments of the inlined functions.

The optimization was implemented into FDPR (Feedback Directed Program Restructuring), a post-link optimizer, which is part of the IBM AIX and Linux operating systems for the IBM pSeries servers. Our experiments were applied after the –O3 optimization phase of the compiler and results on SPECint2000 show an improvement of up to 8% (average of 4%) in execution time, on top of code reordering optimization, resulting from improving code locality and removing corresponding call and return instructions of inlined functions.

By: Omer Boehm; Daniel Citron; Gadi Haber; Moshe Klausner; Roy Levin

Published in: H-0247 in 2006

LIMITED DISTRIBUTION NOTICE:

This Research Report is available. This report has been submitted for publication outside of IBM and will probably be copyrighted if accepted for publication. It has been issued as a Research Report for early dissemination of its contents. In view of the transfer of copyright to the outside publisher, its distribution outside of IBM prior to publication should be limited to peer communications and specific requests. After outside publication, requests should be filled only by reprints or legally obtained copies of the article (e.g., payment of royalties). I have read and understand this notice and am a member of the scientific community outside or inside of IBM seeking a single copy only.

h-0247.pdf

Questions about this service can be mailed to reports@us.ibm.com .