SILCombine: limit the worklist size for instruction canonicalization

To be precise: don't add instruction uses to the worklist if it already has more than 10000 elements.
This avoids quadratic behavior for very large functions.

rdar://problem/56268570
This commit is contained in:
Erik Eckstein
2020-04-10 12:09:59 +02:00
parent 4e2cffbbed
commit d73686a5b5
2 changed files with 6 additions and 1 deletions

View File

@@ -131,7 +131,9 @@ public:
}
void notifyHasNewUsers(SILValue value) override {
Worklist.addUsersToWorklist(value);
if (Worklist.size() < 10000) {
Worklist.addUsersToWorklist(value);
}
changed = true;
}