File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
lib/SILOptimizer/Transforms Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,17 @@ bool CodeMotionContext::run() {
254
254
// Initialize the data flow.
255
255
initializeCodeMotionDataFlow ();
256
256
257
+ if (RCRootVault.size () > 500 ) {
258
+ // Emergency exit to avoid bad compile time problems in rare corner cases.
259
+ // This limit is more than enough for "real world" code.
260
+ // Even large functions have < 100 locations.
261
+ // But in some corner cases - especially in generated code - we can run
262
+ // into quadratic complexity for large functions.
263
+ // TODO: eventually the ARCCodeMotion passes will be replaced by OSSA
264
+ // optimizations which shouldn't have this problem.
265
+ return false ;
266
+ }
267
+
257
268
// Converge the BBSetOut with iterative data flow.
258
269
if (MultiIteration) {
259
270
initializeCodeMotionBBMaxSet ();
Original file line number Diff line number Diff line change @@ -1204,6 +1204,17 @@ bool DSEContext::run() {
1204
1204
//
1205
1205
// Initialize the BBToLocState mapping.
1206
1206
unsigned LocationNum = this ->getLocationVault ().size ();
1207
+
1208
+ if (LocationNum > 500 ) {
1209
+ // Emergency exit to avoid bad compile time problems in rare corner cases.
1210
+ // This limit is more than enough for "real world" code.
1211
+ // Even large functions have < 100 locations.
1212
+ // But in some corner cases - especially in generated code - we can run
1213
+ // into quadratic complexity for large functions.
1214
+ // TODO: implement DSE with a better (non-quadratic) algorithm
1215
+ return false ;
1216
+ }
1217
+
1207
1218
for (auto bs : BBToLocState) {
1208
1219
bs.data .init (&bs.block , LocationNum, Optimistic);
1209
1220
bs.data .initStoreSetAtEndOfBlock (*this );
You can’t perform that action at this time.
0 commit comments