Code Factoring Optimizations

Table of Contents

Latest News


Add sequence abstraction on tree, add sinking part of local factoring on Tree-SSA.


Some more details about the algorithms and some preliminary results added. To do list published.


The branch is now open.


Code factoring is the name of a class of useful optimization techniques developed especially for code size reduction. These approaches aim to reduce size by restructuring the code.

The goal of this project is to add a new extension for improving the code size optimization of GCC with code factoring methods (code motion and merging algorithms). The implementation currently resides on the branch.


Checkout the cfo-branch branch from our respository.

When posting to the development lists, please mark messages and patches with [cfo] in the subject. The usual contribution and testing rules apply. This branch is maintained by Gabor Loki.


The project includes the following two code factoring algorithms:

Both algorithms have an opportunity of working on two different levels (Tree and RTL). Both have their own advantages and disadvantages. This project holds both types for future investigations.

For more information about code factoring see the article in the GCC Summit Proceedings (2004).


Currently the following algorithms are implemented on the branch:

Preliminary results

The following results have been prepared using the CSiBE benchmark with respect to the mainline at the last merge (2005-07-11).

  Code size save Compilation time multiplier
Target arm-elf i686-linux arm-elf i686-linux
Sequence abstraction on RTL 1.07% 1.43% 1.94 1.26
Sequence abstraction on Tree 0.34% 0.18% 1.25 1.25
Local factoring on RTL 0.11% 0.19% 1.01 0.99
Local factoring on Tree-SSA 0.31% 0.24% 1.02 1.01
Overall 1.96% 1.94% 2.08 1.49

To do