Skip to content

Commit b18cf5d

Browse files
committed
[LoopInterchange] Enable it by default (WIP)
This is a work in progress patch to enable loop-interchange by default and is a continuation of the RFC: https://discourse.llvm.org/t/enabling-loop-interchange/82589 Basically, we promised to fix any compile-time and correctness issues in the different components involved here (loop-interchange and dependence analaysis.) before discussing enabling interchange by default. We think are close to complete this; I would like to explain where we are and wanted to check if there are any thoughts or concerns. A quick overview of the correctness and compile-time improvements that we have made include: Correctness: - [LoopInterchange] Remove 'S' Scalar Dependencies (llvm#119345) - [LoopInterchange] Fix overflow in cost calculation (llvm#111807) - [LoopInterchange] Handle LE and GE correctly (PR llvm#124901) @kasuga-fj - [DA] disambiguate evolution of base addresses (llvm#116628) Compile-times: - [LoopInterchange] Constrain number of load/stores in a loop (llvm#118973) - [LoopInterchange] Bail out early if minimum loop nest is not met (llvm#115128) - [LoopInterchange] Hoist isComputableLoopNest() in the control flow (llvm#124247) And in terms of remaining work, we think we are very close to fixing these depenence analysis issues: - [DA] do not handle array accesses of different offsets (llvm#123436) - [DA] Dependence analysis does not handle array accesses of different sizes (llvm#116630) - [DA] use NSW arithmetic llvm#116632 The compile-time increase with a geomean increase of 0.19% looks good (after committing llvm#124247), I think: stage1-O3: Benchmark kimwitu++ +0.10% sqlite3 +0.14% consumer-typeset +0.07% Bullet +0.06% tramp3d-v4 +0.21% mafft +0.39% ClamAVi +0.06% lencod +0.61% SPASS +0.17% 7zip +0.08% geomean +0.19% See also: http://llvm-compile-time-tracker.com/compare.php?from=19a7fe03b4f58c4f73ea91d5e63bc4c6e61f987b&to=b24f1367d68ee675ea93ecda4939208c6b68ae4b&stat=instructions%3Au We might want to look into lencod to see if we can improve more, but not sure it is strictly necessary.
1 parent 77803e4 commit b18cf5d

8 files changed

+8
-1
lines changed

llvm/lib/Passes/PassBuilderPipelines.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static cl::opt<bool> RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden,
201201
cl::desc("Run the NewGVN pass"));
202202

203203
static cl::opt<bool> EnableLoopInterchange(
204-
"enable-loopinterchange", cl::init(false), cl::Hidden,
204+
"enable-loopinterchange", cl::init(true), cl::Hidden,
205205
cl::desc("Enable the experimental LoopInterchange Pass"));
206206

207207
static cl::opt<bool> EnableUnrollAndJam("enable-unroll-and-jam",

llvm/test/Other/new-pm-defaults.ll

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
192192
; CHECK-EP-LOOP-LATE-NEXT: Running pass: NoOpLoopPass
193193
; CHECK-O-NEXT: Running pass: LoopDeletionPass
194+
; CHECK-O-NEXT: Running pass: LoopInterchange
194195
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
195196
; CHECK-EP-LOOP-END-NEXT: Running pass: NoOpLoopPass
196197
; CHECK-O-NEXT: Running pass: SROAPass on foo

llvm/test/Other/new-pm-thinlto-postlink-defaults.ll

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
123123
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
124124
; CHECK-O-NEXT: Running pass: LoopDeletionPass
125+
; CHECK-O-NEXT: Running pass: LoopInterchangePass
125126
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
126127
; CHECK-O-NEXT: Running pass: SROAPass on foo
127128
; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass

llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
109109
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
110110
; CHECK-O-NEXT: Running pass: LoopDeletionPass
111+
; CHECK-O-NEXT: Running pass: LoopInterchangePass
111112
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
112113
; CHECK-O-NEXT: Running pass: SROAPass on foo
113114
; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass

llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
118118
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
119119
; CHECK-O-NEXT: Running pass: LoopDeletionPass
120+
; CHECK-O-NEXT: Running pass: LoopInterchangePass
120121
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
121122
; CHECK-O-NEXT: Running pass: SROAPass on foo
122123
; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass

llvm/test/Other/new-pm-thinlto-prelink-defaults.ll

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
155155
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
156156
; CHECK-O-NEXT: Running pass: LoopDeletionPass
157+
; CHECK-O-NEXT: Running pass: LoopInterchangePass
157158
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
158159
; CHECK-O-NEXT: Running pass: SROAPass on foo
159160
; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass

llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
158158
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
159159
; CHECK-O-NEXT: Running pass: LoopDeletionPass
160+
; CHECK-O-NEXT: Running pass: LoopInterchangePass
160161
; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
161162
; CHECK-O-NEXT: Running pass: SROAPass on foo
162163
; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass

llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
; CHECK-O-NEXT: Running pass: LoopIdiomRecognizePass
123123
; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
124124
; CHECK-O-NEXT: Running pass: LoopDeletionPass
125+
; CHECK-O-NEXT: Running pass: LoopInterchangePass
125126
; CHECK-O-NEXT: Running pass: SROAPass on foo
126127
; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
127128
; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass

0 commit comments

Comments
 (0)