[all-commits] [llvm/llvm-project] b7877e: [ConstraintElim] Derive an unsigned IV bound from ...

Florian Hahn via All-commits all-commits at lists.llvm.org
Sun Sep 13 11:09:58 PDT 2026


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

  Changed paths:
    M llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
    M llvm/test/Transforms/ConstraintElimination/induction-relational-predicate-latch.ll

  Log Message:
  -----------
  [ConstraintElim] Derive an unsigned IV bound from a signed relational latch. (#222762)

For a known non-negative backedge (either via isKnownNonNegative or
because the increment is increasing), 0 <=s PN <= B holds and implies
that B is non-negative as well.

Use that to translate a signed condition to the equivalent unsigned one.

Note that the general signed->unsigned rewrite cannot catch this,
because the precondition also needs rewriting to unsigned.

No llvm-opt-benchmark-nightly impact, but it can help remove runtime
checks generated by sanitizers or Swift code. An end-to-end C example is
https://clang.godbolt.org/z/vbd91MjaM.

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

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



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