[all-commits] [llvm/llvm-project] b9be4c: [LoopInterchange] Avoid overflow in the memory-ins...

Matt via All-commits all-commits at lists.llvm.org
Sun Sep 20 14:33:40 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9be4cc5100477dd5580e11808df046c08bc525b
      https://github.com/llvm/llvm-project/commit/b9be4cc5100477dd5580e11808df046c08bc525b
  Author: Matt <MattPD at users.noreply.github.com>
  Date:   2026-09-20 (Sun, 20 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopInterchange.cpp
    M llvm/test/Transforms/LoopInterchange/memory-instr-ratio.ll

  Log Message:
  -----------
  [LoopInterchange] Avoid overflow in the memory-instruction ratio check (#214920)

populateDependencyMatrix bails out if MaxMemInstrRatio * NumInsts is
less than NumMemInstr * NumMemInstr. Both products are computed in
32-bit unsigned arithmetic and can wrap, e.g., with
-loop-interchange-max-mem-instr-ratio=2147483648 and 20 instructions the
left product wraps to 0 and the pass rejects an otherwise eligible nest.

Compute both products in uint64_t instead, which cannot overflow as all
three operands are 32 bits wide.

Assisted-by: Claude Opus 5, GPT-5.6 Sol, GPT-6 Astra, Claude Fable 5.1.

Co-authored-by: Matt P. Dziubinski <matt-p.dziubinski at hpe.com>



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