Loop Fusion
Loop fusion (merging two or more loops together):
- fusing loops that refer to the same data enhances temporal locality
- larger loop body allow more effective scalar optimizations
-
-
-
- loop peeling can be used to break data dependencies when fusing loops
- sometimes temporary arrays can be replaced by scalars (this optimization has to be done manually)
- Compiler will attempt fuse loops if they are adjacent, i.e. no code between the loops to be fused
-LNO:fusion=[0,1,2] (default 1)