This is not a Wikipedia article: It is an individual user's work-in-progress page, and may be incomplete and/or unreliable. For guidance on developing this draft, see Wikipedia:So you made a userspace draft. Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
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
editMost 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.