Skip to main content
Article
Efficient and Effective Branch Reordering Using Profile Data
ACM Transactions on Programming Languages and Systems (TOPLAS)
  • Minghui Yang, Oracle Corporation
  • Gang-Ryung Uh, Boise State University
  • David B. Whalley, Florida State University
Document Type
Conference Proceeding
Publication Date
11-1-2002
Disciplines
Abstract
The conditional branch has long been considered an expensive operation. The relative cost of conditional branches has increased as recently designed machines are now relying on deeper pipelines and higher multiple issue. Reducing the number of conditional branches executed often results in a substantial performance benefit. This paper describes a code-improving transformation to reorder sequences of conditional branches that compare a common variable to constants. The goal is to obtain an ordering where the fewest average number of branches in the sequence will be executed. First, sequences of branches that can be reordered are detected in the control flow. Second, profiling information is collected to predict the probability that each branch will transfer control out of the sequence. Third, the cost of performing each conditional branch is estimated. Fourth, the most beneficial ordering of the branches based on the estimated probability and cost is selected. The most beneficial ordering often includes the insertion of additional conditional branches that did not previously exist in the sequence. Finally, the control flow is restructured to reflect the new ordering. The results of applying the transformation are on average reductions of about 8%; fewer instructions executed and 13%; branches performed, as well as about a 4%; decrease in execution time.
Citation Information
Minghui Yang, Gang-Ryung Uh and David B. Whalley. "Efficient and Effective Branch Reordering Using Profile Data" ACM Transactions on Programming Languages and Systems (TOPLAS) (2002)
Available at: http://works.bepress.com/gang-ryung_uh/7/