[all-commits] [llvm/llvm-project] e3e25b: [NewPM] Add option to prevent rerunning function p...

aeubanks via All-commits all-commits at lists.llvm.org
Wed Nov 17 09:07:10 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e3e25b51122573c12c30f25b1b3a1b556fca237b
      https://github.com/llvm/llvm-project/commit/e3e25b51122573c12c30f25b1b3a1b556fca237b
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2021-11-17 (Wed, 17 Nov 2021)

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

  Log Message:
  -----------
  [NewPM] Add option to prevent rerunning function pipeline on functions in CGSCC adaptor

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.

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

Reviewed By: asbirlea, nikic

Differential Revision: https://reviews.llvm.org/D113947




More information about the All-commits mailing list