[all-commits] [llvm/llvm-project] bb9580: [SCEV] Use ashr to adjust constant multipliers (#1...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Sun Apr 13 05:23:09 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb9580a02b393683ff0b6c360df684f33c715a1f
      https://github.com/llvm/llvm-project/commit/bb9580a02b393683ff0b6c360df684f33c715a1f
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-04-13 (Sun, 13 Apr 2025)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    A llvm/test/Analysis/ScalarEvolution/pr135531.ll

  Log Message:
  -----------
  [SCEV] Use ashr to adjust constant multipliers (#135534)

SCEV converts "-2 *nsw (i32 V)" into "2148473647 *nsw (i32 V)". But we
cannot preserve the nsw flag when the constant multiplier is negative.
This patch changes lshr to ashr so that we can preserve both nsw and nuw
flags.

Alive2 proof: https://alive2.llvm.org/ce/z/LZVSEa
Closes https://github.com/llvm/llvm-project/issues/135531.



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