@@ -102,7 +102,8 @@ class ArrayPropertiesAnalysis {
102
102
// / Check if it is profitable to specialize a loop when you see an apply
103
103
// / instruction. We consider it is not profitable to specialize the loop when:
104
104
// / 1. The callee is not found in the module, or cannot be determined
105
- // / 2. The number of instructions the analysis scans has exceeded the AnalysisThreshold
105
+ // / 2. The number of instructions the analysis scans has exceeded the
106
+ // / AnalysisThreshold
106
107
uint32_t checkProfitabilityRecursively (SILFunction *Callee) {
107
108
if (!Callee)
108
109
return AnalysisThreshold;
@@ -118,16 +119,19 @@ class ArrayPropertiesAnalysis {
118
119
for (auto &BB : *Callee) {
119
120
for (auto &I : BB) {
120
121
if (InstCount++ >= AnalysisThreshold) {
121
- LLVM_DEBUG (llvm::dbgs () << " ArrayPropertyOpt: Disabled Reason - Exceeded Analysis Threshold in "
122
+ LLVM_DEBUG (llvm::dbgs () << " ArrayPropertyOpt: Disabled Reason - "
123
+ " Exceeded Analysis Threshold in "
122
124
<< BB.getParent ()->getName () << " \n " );
123
125
InstCountCache[Callee] = AnalysisThreshold;
124
126
return AnalysisThreshold;
125
127
}
126
128
if (auto Apply = FullApplySite::isa (&I)) {
127
129
auto Callee = Apply.getReferencedFunctionOrNull ();
128
130
if (!Callee) {
129
- LLVM_DEBUG (llvm::dbgs () << " ArrayPropertyOpt: Disabled Reason - Found opaque code in "
130
- << BB.getParent ()->getName () << " \n " );
131
+ LLVM_DEBUG (
132
+ llvm::dbgs ()
133
+ << " ArrayPropertyOpt: Disabled Reason - Found opaque code in "
134
+ << BB.getParent ()->getName () << " \n " );
131
135
LLVM_DEBUG (Apply.dump ());
132
136
LLVM_DEBUG (I.getOperand (0 )->dump ());
133
137
}
@@ -182,9 +186,11 @@ class ArrayPropertiesAnalysis {
182
186
if (!FoundHoistable)
183
187
return false ;
184
188
185
- // If the LoopInstCount exceeds the threshold, we will disable the optimization on this loop
186
- // For loops of deeper nesting we increase the threshold by an additional 10%
187
- if (LoopInstCount > LoopInstCountThreshold * (1 + (Loop->getLoopDepth () - 1 ) / 10 )) {
189
+ // If the LoopInstCount exceeds the threshold, we will disable the
190
+ // optimization on this loop For loops of deeper nesting we increase the
191
+ // threshold by an additional 10%
192
+ if (LoopInstCount >
193
+ LoopInstCountThreshold * (1 + (Loop->getLoopDepth () - 1 ) / 10 )) {
188
194
LLVM_DEBUG (llvm::dbgs () << " Exceeded LoopInstCountThreshold\n " );
189
195
return false ;
190
196
}
@@ -205,8 +211,9 @@ class ArrayPropertiesAnalysis {
205
211
}
206
212
}
207
213
208
- LLVM_DEBUG (llvm::dbgs () << " Profitable ArrayPropertyOpt in "
209
- << Loop->getLoopPreheader ()->getParent ()->getName () << " \n " );
214
+ LLVM_DEBUG (llvm::dbgs ()
215
+ << " Profitable ArrayPropertyOpt in "
216
+ << Loop->getLoopPreheader ()->getParent ()->getName () << " \n " );
210
217
LLVM_DEBUG (Loop->dump ());
211
218
return true ;
212
219
}
0 commit comments