[all-commits] [llvm/llvm-project] d7f2ab: [SCEV] Use the refined BE-count formula if the add...

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Sep 10 06:34:22 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d7f2abda7020b4ca336732dd2984f6a668fd766a
      https://github.com/llvm/llvm-project/commit/d7f2abda7020b4ca336732dd2984f6a668fd766a
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/no-wrap-symbolic-becount.ll
    M llvm/test/Analysis/ScalarEvolution/trip-count-unknown-stride.ll

  Log Message:
  -----------
  [SCEV] Use the refined BE-count formula if the addition cannot overflow (#221227)

Generalize the logic added in
https://github.com/llvm/llvm-project/pull/218694
to consider AddingStrideMinusOneMayOverflow (was MayAddOverflow) instead
of just the !IVMayOverflow part.

This handles 2 additional cases when Start < RHS:
 * Stride is known power-of-2:
 * Start == Stride and Start == Stride -1.

The patch includes a mechanical change to move up the existing
MayAddOverflow with comments, and clarifies the name to
AddingStrideMinusOneMayOverflow.

This improves trip count computations in a number of real-world cases:
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1195.

End-to-end Alive2 Proofs for both cases in unsigned:
https://alive2.llvm.org/ce/z/MQ2YLf

PR: https://github.com/llvm/llvm-project/pull/221227



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