18
- https://doi.org/10.1002/spe.627
Branch elimination by condition merging
- Nov 17, 2004
- Software: Practice and Experience
- William C Kreahling +5 more
Conditional branches are expensive. Branches require a significant percentage of execution cycles since they occur frequently and cause pipeline flushes when mispredicted. In addition, branches result in forks in the control flow, which can prevent other code-improving transformations from being applied. In this paper we describe profile-based techniques for replacing the execution of a set of two or more branches with a single branch on a conventional scalar processor. These sets of branches can include tests of multiple variables. For instance, the test if (p1 ! = 0 && p2 ! = 0), which is testing for NULL pointers, can be replaced with if (p1 & p2 ! = 0). Program profiling is performed to target condition merging along frequently executed paths. The results show that eliminating branches by merging conditions can significantly reduce the number of conditional branches executed in non-numerical applications.
- # Sets Of Branches
- # Branch Elimination
- # Merging Conditions
- # Conditional Branches
- # Code-improving Transformations
- # Single Branch
- # Control Flow
- # Conventional Processor
- # Number Of Branches
- # Profile-based Techniques