Skip to content

Commit 7156ba3

Browse files
authored
[NFC] Mark some DAE-internal passes as requiring less work (#7858)
The non-nullable overhead usually doesn't matter, but DAE can end up running many internal pass iterations, many of whom are very lightweight otherwise, so this adds up. On a dart testcase I see, this makes DAE (the slowest pass there) 7% faster.
1 parent 5593b32 commit 7156ba3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/passes/DeadArgumentElimination.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ using DAEFunctionInfoMap = std::unordered_map<Name, DAEFunctionInfo>;
9494
struct DAEScanner
9595
: public WalkerPass<PostWalker<DAEScanner, Visitor<DAEScanner>>> {
9696
bool isFunctionParallel() override { return true; }
97+
bool modifiesBinaryenIR() override { return false; }
9798

9899
std::unique_ptr<Pass> create() override {
99100
return std::make_unique<DAEScanner>(infoMap);

src/passes/param-utils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ void localizeCallsTo(const std::unordered_set<Name>& callTargets,
290290
std::function<void(Function*)> onChange) {
291291
struct LocalizerPass : public WalkerPass<PostWalker<LocalizerPass>> {
292292
bool isFunctionParallel() override { return true; }
293+
// May add non-nullable locals, but fixups are never needed as they are
294+
// immediately used in the code right after.
295+
bool requiresNonNullableLocalFixups() override { return false; }
293296

294297
std::unique_ptr<Pass> create() override {
295298
return std::make_unique<LocalizerPass>(callTargets, onChange);
@@ -335,6 +338,8 @@ void localizeCallsTo(const std::unordered_set<HeapType>& callTargets,
335338
PassRunner* runner) {
336339
struct LocalizerPass : public WalkerPass<PostWalker<LocalizerPass>> {
337340
bool isFunctionParallel() override { return true; }
341+
// See above.
342+
bool requiresNonNullableLocalFixups() override { return false; }
338343

339344
std::unique_ptr<Pass> create() override {
340345
return std::make_unique<LocalizerPass>(callTargets);

0 commit comments

Comments
 (0)