1 Removing Impediments to Loop Fusion Through Code Transformations Bob Blainey 1, Christopher Barton 2, and Jos’e Nelson Amaral 2 1 IBM Toronto Software Laboratory, Toronto, Canada 2 Department of Computing Science, University of Alberta, Edmonton, Canada Yao-Huei Fang Adviser: Professor Chung Yung
2 Outline 1. Introduction 2. Overview of Loop Optimizations 3. Loop Fusion Algorithm 4. Results
Introduction Two important typically performed in a loop restructuring compiler are loop fusion and loop distribution. The loop fusion’s advantages: decreases the number of loop branches executed creates opportunities for data reuse offers more instructions for the scheduler to balance the use of functional units The loop fusion’s disadvantages: increased code size increased register pressure potential over-commiting of hardware resources and the formation more complex control flow 3
Overview of Loop Optimizations 4
Example of aggressive copy propagation 5
Loop Fusion Algorithm We divide loops into two classes: loops that are eligible for fusion and loops that are not eligible for fusion. two loops that are eligible for fusion must satisfy the following conditions: – they must be conforming, – they must be control equivalent, – they must be adjacent, and – there can be only forward dependences between the loop bodies. 6
Conti. 7
8
Example of Algorithm 9
Conti. 10
Conti. 11
12
Result 13
Conti. 14