[all-commits] [llvm/llvm-project] 8ea8a2: [IRCE] Discard speculative SCEV expansions when ba...

Keno Fischer via All-commits all-commits at lists.llvm.org
Tue Jul 28 08:43:52 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ea8a288d3a4a446c2229c9d8f682723dd33eee5
      https://github.com/llvm/llvm-project/commit/8ea8a288d3a4a446c2229c9d8f682723dd33eee5
  Author: Keno Fischer <keno at juliahub.com>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/LoopConstrainer.h
    M llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
    M llvm/lib/Transforms/Utils/LoopConstrainer.cpp
    M llvm/test/Transforms/IRCE/compound-loop-bound.ll
    A llvm/test/Transforms/IRCE/expansion-cleanup-analysis-invalidation.ll

  Log Message:
  -----------
  [IRCE] Discard speculative SCEV expansions when bailing out (#211089)

LoopStructure::parseLoopStructure materializes SCEVs in the preheader
while merely analyzing the loop, and LoopConstrainer::run expands its
exit limits before all of its bail-out points have been passed. When a
later check failed, those expansions were left behind: the pass mutated
the IR while reporting the function unchanged, which leaves stale
analyses behind (observable with -verify-analysis-invalidation) and
produces dead instructions that differ depending on how far the analysis
got.

Fix this by having callers own the SCEVExpander passed to
parseLoopStructure and wrapping both expanders (IRCE's and
LoopConstrainer::run's) in a SCEVExpanderCleaner whose result is only
marked used once the transformation is guaranteed to proceed. Value
names ("indvar.start", "exit.preloop.at") are now applied only at that
point, since the expander may have reused pre-existing values that must
not be renamed when the transformation is abandoned.

Also return the correct Changed value from
InductiveRangeCheckElimination::run when subrange computation fails,
since earlier steps may already have modified the function.

Co-authored-by: Claude Fable 5 <noreply at anthropic.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