[all-commits] [llvm/llvm-project] b1f416: [IPSCCP] Decouple queries for function analysis re...

Alexandros Lamprineas via All-commits all-commits at lists.llvm.org
Thu Jun 1 08:41:40 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b1f41685a60e5416af8f636393bffd03ac4c13f5
  Author: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
    M llvm/include/llvm/Transforms/Utils/SCCPSolver.h
    M llvm/lib/Transforms/IPO/SCCP.cpp
    M llvm/lib/Transforms/Utils/SCCPSolver.cpp
    A llvm/test/Transforms/SCCP/ipsccp-preserve-pdt.ll

  Log Message:
  [IPSCCP] Decouple queries for function analysis results.

The SCCPSolver is using a structure (AnalysisResultsForFn) where it keeps
pointers to various analyses needed by the IPSCCP pass. These analyses are
requested all at the same time, which can become problematic in some cases.
For example one could be retrieved via getCachedAnalysis() prior to the
actual execution of the analysis. In more detail:

The IPSCCP pass uses a DomTreeUpdater to preserve the PostDominatorTree
in case the PostDominatorTreeAnalysis had run before IPSCCP. Starting with
commit 1b1232047e83b the IPSCCP pass may use BlockFrequencyAnalysis for
some functions in the module. As a result, the PostDominatorTreeAnalysis
may not run until the BlockFrequencyAnalysis has run, since the latter
analysis depends on the former. Currently, we setup the DomTreeUpdater
using getCachedAnalysis to retrieve a PostDominatorTree. This happens
before BlockFrequencyAnalysis has run, therefore the cached analysis can
become invalid by the time we use it.

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

More information about the All-commits mailing list