[all-commits] [llvm/llvm-project] 065280: [CodeGen][NPM] Clear MachineFunctions without usin...

Vikram Hegde via All-commits all-commits at lists.llvm.org
Thu Jul 17 23:28:22 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 06528070fce04d580821b3448f1d5321e0a9a97b
      https://github.com/llvm/llvm-project/commit/06528070fce04d580821b3448f1d5321e0a9a97b
  Author: Vikram Hegde <115221833+vikramRH at users.noreply.github.com>
  Date:   2025-07-18 (Fri, 18 Jul 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
    M llvm/include/llvm/IR/PassManager.h
    M llvm/include/llvm/Passes/CodeGenPassBuilder.h
    M llvm/lib/CodeGen/MachineFunctionAnalysis.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
    M llvm/test/tools/llc/new-pm/start-stop.ll

  Log Message:
  -----------
  [CodeGen][NPM] Clear MachineFunctions without using PA (#148113)

same as https://github.com/llvm/llvm-project/pull/139517

This replaces the InvalidateAnalysisPass<MachineFunctionAnalysis> pass.

There are no cross-function analysis requirements right now, so clearing
all analyses works for the last pass in the pipeline.

Having the InvalidateAnalysisPass<MachineFunctionAnalysis>() is causing
a problem with ModuleToCGSCCPassAdaptor by deleting machine functions
for other functions and ending up with exactly one correctly compiled
MF, with the rest being vanished.

This is because ModuleToCGSCCPAdaptor propagates PassPA (received from
the CGSCCToFunctionPassAdaptor that runs the actual codegen pipeline on
MFs) to the next SCC. That causes MFA invalidation on functions in the
next SCC.

For us, PassPA happens to be returned from
invalidate<machine-function-analysis> which abandons the
MachineFunctionAnalysis. So while the first function runs through the
pipeline normally, invalidate also deletes the functions in the next SCC
before its pipeline is run. (this seems to be the intended mechanism of
the CG adaptor to allow cross-SCC invalidations.

Co-authored-by : Oke, Akshat
<[Akshat.Oke at amd.com](mailto:Akshat.Oke at amd.com)>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list