[all-commits] [llvm/llvm-project] 9a49fc: [LoopInfo] Replace raw loop-container accessors wi...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jul 21 00:01:42 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a49fc244be7400e550b2c014e6d370b586dc854
      https://github.com/llvm/llvm-project/commit/9a49fc244be7400e550b2c014e6d370b586dc854
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-07-21 (Tue, 21 Jul 2026)

  Changed paths:
    M bolt/lib/Core/BinaryFunction.cpp
    M llvm/include/llvm/Support/GenericLoopInfo.h
    M llvm/include/llvm/Support/GenericLoopInfoImpl.h
    M llvm/lib/Target/AMDGPU/AMDGPUNextUseAnalysis.cpp
    M llvm/lib/Transforms/Scalar/LoopDeletion.cpp
    M llvm/lib/Transforms/Scalar/LoopPredication.cpp
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    M llvm/lib/Transforms/Utils/FixIrreducible.cpp
    M llvm/lib/Transforms/Utils/LoopPeel.cpp
    M llvm/lib/Transforms/Utils/LoopUtils.cpp
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/lib/Transforms/Vectorize/VPlan.cpp
    M polly/lib/Analysis/ScopDetection.cpp

  Log Message:
  -----------
  [LoopInfo] Replace raw loop-container accessors with semantic operations (#210653)

getBlocksVector, mutable getBlocksSet, getSubLoopsVector, and
getTopLevelLoopsVector expose LoopInfo's internal containers, so every
caller open-codes loop-nest surgery, keeps the block vector and set in
sync by hand, and freezes the representation. Replace them with two
LoopInfoBase operations:

* removeBlocksIf(LoopT &, Pred): drop matching blocks from a loop.
* takeChildrenIf(LoopT *Parent, Pred): detach and return matching
  children, clearing their parent; a null Parent means the top level.

Both preserve the relative order of what remains. Mutation inside
LoopInfoBase also lets the analysis repair derived state once per edit
and finish a multi-step edit before any query observes it, which an
accessor returning a container cannot.

For the same reason, move hasNoExitBlocks, getExitEdges, and
getUniqueLatchExitBlock onto LoopInfoBase.

Two behavior changes: SimpleLoopUnswitch's deleteDeadBlocksFromLoop runs
its per-child deletion callbacks while the forest is still consistent,
before detaching and destroying dead children; FixIrreducible's
reconnectChildLoops keeps children in their original order rather than
std::partition's.

Aided by Claude Fable 5



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