[all-commits] [llvm/llvm-project] 34ed49: [SCEV] Infer addrec nowrap flags during range anal...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Jun 24 03:43:21 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 34ed491f6375a39248f71a98eaab5810dfc1324e
      https://github.com/llvm/llvm-project/commit/34ed491f6375a39248f71a98eaab5810dfc1324e
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2026-06-24 (Wed, 24 Jun 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/Delinearization/global_array_bounds.ll
    M llvm/test/Analysis/DependenceAnalysis/Banerjee.ll
    M llvm/test/Analysis/DependenceAnalysis/BasePtrBug.ll
    M llvm/test/Analysis/DependenceAnalysis/Constraints.ll
    M llvm/test/Analysis/DependenceAnalysis/DifferentOffsets.ll
    M llvm/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll
    M llvm/test/Analysis/DependenceAnalysis/Propagating.ll
    M llvm/test/Analysis/LoopAccessAnalysis/clamped-access-pattern.ll
    M llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
    M llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll
    M llvm/test/Analysis/LoopAccessAnalysis/symbolic-stride.ll
    M llvm/test/Analysis/ScalarEvolution/addrec-computed-during-addrec-calculation.ll
    M llvm/test/Analysis/ScalarEvolution/backedge-taken-count-guard-info.ll
    M llvm/test/Analysis/ScalarEvolution/becount-invalidation.ll
    M llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll
    M llvm/test/Analysis/ScalarEvolution/exit-count-non-strict.ll
    M llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll
    M llvm/test/Analysis/ScalarEvolution/incorrect-exit-count.ll
    M llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll
    M llvm/test/Analysis/ScalarEvolution/limit-depth.ll
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-operand-order.ll
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
    M llvm/test/Analysis/ScalarEvolution/mul-udiv-folds.ll
    M llvm/test/Analysis/ScalarEvolution/pr123550.ll
    M llvm/test/Analysis/ScalarEvolution/pr22641.ll
    M llvm/test/Analysis/ScalarEvolution/ptrtoint.ll
    M llvm/test/Analysis/ScalarEvolution/sext-iv-2.ll
    M llvm/test/Analysis/ScalarEvolution/sext-mul.ll
    M llvm/test/Analysis/ScalarEvolution/trip-count-negative-stride.ll
    M llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll
    M llvm/test/CodeGen/PowerPC/mma-intrinsics.ll
    M llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll
    M llvm/test/Transforms/LoopInterchange/fixed-size-no-signed-wrap.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/masked_gather_scatter.ll
    M llvm/test/Transforms/LoopVectorize/X86/cast-costs.ll
    M llvm/test/Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll
    M llvm/test/Transforms/LoopVectorize/iv-select-cmp-trunc.ll
    M polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll

  Log Message:
  -----------
  [SCEV] Infer addrec nowrap flags during range analysis (#202964)

When we're computing the range of the addrec, we already have to reason
about whether it wraps, so we may as well determine the nowrap flags at
the same time.

This is more precise than the previous logic that took the addrec range
and checked whether adding a step to it does not wrap. For example, an
`{0,+,1}` addrec with a full range can still be non-wrapping.

Note that I removed some assertions in the SCEV printed that predicated
exit counts actually have predicates. Due to SCEV's query order
dependence, this can happen, also prior to this change, see for example
https://llvm.godbolt.org/z/cWK1MMEqv. While this indicates suboptimal
results, it's not a bug, and we should not assert.

Fixes https://github.com/llvm/llvm-project/issues/200788.



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