GCC Lands Loop Splitting Optimization
The latest GCC 7 development code has an optimization pass now for loop splitting.
The GCC documentation on the loop splitting pass explains, "If a loop contains a conditional statement that is always true for one part of the iteration space and false for the other this pass splits the loop into two, one dealing with one side the other only with the other, thereby removing one inner-loop conditional."
The pass can be turned on by the -fsplit-loops switch or it's also enabled by default when building with -O3.
There are some performance measurements with loop splitting enabled via this mailing list post but at most it's making around a 1% difference for select code-bases. The splt-loops pass is now in the GCC code-base and will be found with the GCC 7.1 stable release in early 2017.
The GCC documentation on the loop splitting pass explains, "If a loop contains a conditional statement that is always true for one part of the iteration space and false for the other this pass splits the loop into two, one dealing with one side the other only with the other, thereby removing one inner-loop conditional."
The pass can be turned on by the -fsplit-loops switch or it's also enabled by default when building with -O3.
There are some performance measurements with loop splitting enabled via this mailing list post but at most it's making around a 1% difference for select code-bases. The splt-loops pass is now in the GCC code-base and will be found with the GCC 7.1 stable release in early 2017.
5 Comments