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

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Mon Apr 14 12:38:53 PDT 2025


  Branch: refs/heads/release/20.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 0dd4235473d4f5a99c46ea631351616d62e9b32e
      https://github.com/llvm/llvm-project/commit/0dd4235473d4f5a99c46ea631351616d62e9b32e
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-04-14 (Mon, 14 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.

(cherry picked from commit bb9580a02b393683ff0b6c360df684f33c715a1f)



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