[PATCH] D113947: [NewPM] Add option to prevent rerunning function pipeline on functions in CGSCC adaptor

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 15:15:41 PST 2021


aeubanks created this revision.
Herald added subscribers: ormris, hiraditya, eraman.
Herald added a reviewer: ctetreau.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In a CGSCC pass manager, we may visit the same function multiple times
due to SCC mutations. In the inliner pipeline, this results in running
the function simplification pipeline on a function multiple times even
if it hasn't been changed since the last function simplification
pipeline run.

We use a newly introduced analysis to keep track of whether or not a
function has changed since the last time the function simplification
pipeline has run on it. If we see this analysis available for a function
in a CGSCCToFunctionPassAdaptor, we skip running the function passes on
the function. The analysis is queried at the end of the function passes
so that it's available after the first time the function simplification
pipeline runs on a function. This is a per-adaptor option so it doesn't
apply to every adaptor.

The goal of this is to improve compile times. However, currently we
can't turn this on by default at least for the higher optimization
levels since the function simplification pipeline is not robust enough
to be idempotent in many cases, resulting in performance regressions if
we stop running the function simplification pipeline on a function
multiple times. We may be able to turn this on for -O1 in the near
future, but turning this on for higher optimization levels would require
more investment in the function simplification pipeline.

Heavily inspired by D98103 <https://reviews.llvm.org/D98103>.

Example compile time improvements with flag turned on:
https://llvm-compile-time-tracker.com/compare.php?from=998dc4a5d3491d2ae8cbe742d2e13bc1b0cacc5f&to=5c27c913687d3d5559ef3ab42b5a3d513531d61c&stat=instructions


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113947

Files:
  llvm/include/llvm/Analysis/CGSCCPassManager.h
  llvm/include/llvm/Transforms/IPO/Inliner.h
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/no-rerun-function-simplification-pipeline.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113947.387419.patch
Type: text/x-patch
Size: 9763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211115/ef230412/attachment.bin>


More information about the llvm-commits mailing list