[all-commits] [llvm/llvm-project] 916e8f: [DA] Check nsw when extracting a constant operand ...

Ryotaro Kasuga via All-commits all-commits at lists.llvm.org
Thu Oct 30 09:06:52 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 916e8f74a8216e858699fc8533929c013fa3d018
      https://github.com/llvm/llvm-project/commit/916e8f74a8216e858699fc8533929c013fa3d018
  Author: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
  Date:   2025-10-30 (Thu, 30 Oct 2025)

  Changed paths:
    M llvm/lib/Analysis/DependenceAnalysis.cpp
    M llvm/test/Analysis/DependenceAnalysis/GCD.ll
    M llvm/test/Analysis/DependenceAnalysis/SymbolicSIV.ll
    M llvm/test/Analysis/DependenceAnalysis/compute-absolute-value.ll
    M llvm/test/Analysis/DependenceAnalysis/gcd-miv-overflow.ll

  Log Message:
  -----------
  [DA] Check nsw when extracting a constant operand of SCEVMul (#164408)

Given a `SCEVMulExpr` such as `5 * %m`, `gcdMIVtest` in DA assumes the
value as a multiple of 5 in a mathematical sense. However, this is not
necessarily true if `5 * %m` overflows, especially because an odd number
has an inverse modulo `2^64`. Such incorrect assumptions can lead to
invalid analysis results.
This patch stops unconditionally extracting a constant operand from
`SCEVMulExpr`. Instead, it only allows this when the `SCEVMulExpr` has
the `nsw` flag.



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