User:Awesomeclaw/Code-Block Reordering

Code Block Reordering

Code-Block Reordering is a compiler optimisation which involves re-ordering the basic blocks of a region of machine code in order to improve performance. A Code-Block Reordering pass is present in most modern optimising compilers and compiler frameworks including GCC and LLVM.

Benefits
Most modern computer processors include Instruction Cache. Instruction Caches increase the rate at which instructions can be executed by reducing the cost of fetching instructions, while Branch Predictors attempt to speculate on the direction taken by branches and other control flow instructions.

Many systems also include Branch Prediction units, which seek to predict which path will be taken by control flow instructions such as branches. By default, many branch predictors will predict that a branch is 'not taken', i.e. the instructions directly after the control flow instruction will be executed.