[all-commits] [llvm/llvm-project] 4791c3: [SCEV] Propagate a recurrence's nuw flag to mul in...

Florian Hahn via All-commits all-commits at lists.llvm.org
Mon Sep 21 09:43:49 PDT 2026


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

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/test/Analysis/ScalarEvolution/exit-value-nowrap-flags.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/nsw.ll
    M llvm/test/Analysis/ScalarEvolution/ranges.ll
    M llvm/test/Transforms/IndVarSimplify/exit-value-nowrap-flags.ll

  Log Message:
  -----------
  [SCEV] Propagate a recurrence's nuw flag to mul in exit value. (#224974)

Follow-up to #217378. The same reasoning applies to the multiply emitted
as well:

A recurrence's exit value is its closed form Start + BTC * Step. The
multiply does not wrap, if the recurrence does not wrap: the recurrence
reached iteration BTC, so the value it computes there is the value the
recurrence had, and that did not wrap.

Alive2 Proof: https://alive2.llvm.org/ce/z/S3_sRh

Also includes small SCEVExpander changes to thread through operands as
SCEVUse.

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



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