summaryrefslogtreecommitdiff
path: root/src/pass.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pass.h')
-rw-r--r--src/pass.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/pass.h b/src/pass.h
index f4b15a320..2cb661e72 100644
--- a/src/pass.h
+++ b/src/pass.h
@@ -488,10 +488,19 @@ public:
assert(getPassRunner());
// Parallel pass running is implemented in the PassRunner.
if (isFunctionParallel()) {
- // TODO: We should almost certainly be propagating pass options here, but
- // that is a widespread change, so make sure it doesn't unacceptably
- // regress compile times.
- PassRunner runner(module /*, getPassOptions()*/);
+ // Reduce opt/shrink levels to a maximum of one in nested runners like
+ // these, to balance runtime. We definitely want the full levels in the
+ // main passes we run, but nested pass runners are of secondary
+ // importance.
+ // TODO Investigate the impact of allowing the levels to just pass
+ // through. That seems to cause at least some regression in compile
+ // times in -O3, however, but with careful measurement we may find
+ // the benefits are worth it. For now -O1 is a reasonable compromise
+ // as it has basically linear runtime, unlike -O2 and -O3.
+ auto options = getPassOptions();
+ options.optimizeLevel = std::min(options.optimizeLevel, 1);
+ options.shrinkLevel = std::min(options.shrinkLevel, 1);
+ PassRunner runner(module, options);
runner.setIsNested(true);
runner.add(create());
runner.run();