[all-commits] [llvm/llvm-project] b7b743: [DA] Rewrite BanerjeeMIV test with safe APInt inte...

Ruoyu Qiu via All-commits all-commits at lists.llvm.org
Tue Aug 4 23:02:55 PDT 2026


  Branch: refs/heads/users/cabbaken/rewriteBanerjeeTest
  Home:   https://github.com/llvm/llvm-project
  Commit: b7b743f6695b34da8844d2b88e5c8cccc2bd3f42
      https://github.com/llvm/llvm-project/commit/b7b743f6695b34da8844d2b88e5c8cccc2bd3f42
  Author: Ruoyu Qiu <cabbaken at outlook.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/DependenceAnalysis.h
    M llvm/lib/Analysis/DependenceAnalysis.cpp
    M llvm/test/Analysis/DependenceAnalysis/PR51512.ll
    M llvm/test/Analysis/DependenceAnalysis/banerjee-overflow.ll
    M llvm/test/Analysis/DependenceAnalysis/gcd-miv-overflow.ll

  Log Message:
  -----------
  [DA] Rewrite BanerjeeMIV test with safe APInt interval arithmetic

The old banerjeeMIVtest computed inequality bounds using SCEV
arithmetic on 64-bit integers. Intermediate operations like
$(A^{-} - B^{+}) \times Iterations$ could overflow i64 even when all individual
coefficients and loop bounds fit, producing unsound results.

Replace the symbolic bound machinery with a self-contained APInt
interval arithmetic implementation. Key design decisions:

- BanerjeeInterval holds [Lower, Upper] signed-inclusive bounds.
  Operations use APInt arithmetic at WideBits, chosen to guarantee no
  intermediate overflow:
  $$
    WideBits = max(8, 2 \times BaseBits + MaxLevels + 8)
  $$
  This is provably sufficient, each term product needs at most `2 \times BaseBits + 1`
  bits, and summing across MaxLevels terms needs at most ceil($\log_2 (MaxLevels)$)
  extra bits.

- Only constant affine expressions are handled. `CollectConstantAffine`
  requires nsw on every SCEVAddRecExpr and a SCEVConstant for both the
  step recurrence and the backedge-taken count.
  Symbolic cases bail out conservatively.

Fixes the FIXME in gcdmiv_delta_ovfl2.ll: the old code could not
detect the dependence because intermediate SCEV subtraction of
coefficients near INT64_MIN and INT64_MAX overflowed i64. The new code
computes correct bounds at WideBits >= 138.

Adds a test in banerjee-overflow.ll for single-iteration loops and
updates PR51512.ll for the more precise direction refinement.

Signed-off-by: Ruoyu Qiu <cabbaken at outlook.com>


  Commit: ce2565a12f9ac3b2dc755f580eca3dcb7c80ffed
      https://github.com/llvm/llvm-project/commit/ce2565a12f9ac3b2dc755f580eca3dcb7c80ffed
  Author: Ruoyu Qiu <cabbaken at outlook.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/DependenceAnalysis.h
    M llvm/lib/Analysis/DependenceAnalysis.cpp
    A llvm/test/Analysis/DependenceAnalysis/banerjee-symbolic.ll

  Log Message:
  -----------
  Replace APInt with SCEV to add symbolic support


  Commit: 98c1ce3e2b64805ec574daca6434d9682e821f81
      https://github.com/llvm/llvm-project/commit/98c1ce3e2b64805ec574daca6434d9682e821f81
  Author: Ruoyu Qiu <cabbaken at outlook.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/DependenceAnalysis.h

  Log Message:
  -----------
  Restore comments


  Commit: 2754153a25520a8c6f67c6b0ea35e97390e6eb70
      https://github.com/llvm/llvm-project/commit/2754153a25520a8c6f67c6b0ea35e97390e6eb70
  Author: Ruoyu Qiu <cabbaken at outlook.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M llvm/lib/Analysis/DependenceAnalysis.cpp

  Log Message:
  -----------
  Strict the refine of < and > with intersection


  Commit: 1543498bc7022f622b6fa30bfed18ceced80141e
      https://github.com/llvm/llvm-project/commit/1543498bc7022f622b6fa30bfed18ceced80141e
  Author: Ruoyu Qiu <cabbaken at outlook.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/DependenceAnalysis.h
    M llvm/lib/Analysis/DependenceAnalysis.cpp
    M llvm/test/Analysis/DependenceAnalysis/banerjee-symbolic.ll

  Log Message:
  -----------
  Update some comments and some fix


  Commit: 1de7ad32ef2a78a1119c9904a7608884aade1df6
      https://github.com/llvm/llvm-project/commit/1de7ad32ef2a78a1119c9904a7608884aade1df6
  Author: Ruoyu Qiu <cabbaken at outlook.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/DependenceAnalysis.h
    M llvm/lib/Analysis/DependenceAnalysis.cpp
    M llvm/test/Analysis/DependenceAnalysis/banerjee-overflow.ll
    A llvm/test/Analysis/DependenceAnalysis/banerjee-single-iteration.ll
    M llvm/test/Analysis/DependenceAnalysis/banerjee-symbolic.ll

  Log Message:
  -----------
  Update


  Commit: fb52291f03c7da5de57427e008a228e57e9a9e8a
      https://github.com/llvm/llvm-project/commit/fb52291f03c7da5de57427e008a228e57e9a9e8a
  Author: Ruoyu Qiu <cabbaken at outlook.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M llvm/lib/Analysis/DependenceAnalysis.cpp

  Log Message:
  -----------
  Rename unboundedStrictDirectionInterval and add comment


Compare: https://github.com/llvm/llvm-project/compare/c6bdf6dfd715...fb52291f03c7

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