[all-commits] [llvm/llvm-project] efe4e7: [SCEV] Fix incorrect nsw inference for multiply of...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Sep 17 23:23:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: efe4e7a026056758a6bd535a2172a21aee5d41f5
      https://github.com/llvm/llvm-project/commit/efe4e7a026056758a6bd535a2172a21aee5d41f5
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/Delinearization/constant_functions_multi_dim.ll
    M llvm/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll
    M llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
    M llvm/test/Analysis/ScalarEvolution/nsw.ll
    M llvm/test/Transforms/IndVarSimplify/pr66066.ll
    R llvm/test/Transforms/LoopDataPrefetch/AArch64/pr43784.ll

  Log Message:
  -----------
  [SCEV] Fix incorrect nsw inference for multiply of addrec (#66500)

SCEV currently preserves the nsw flag when performing an nsw multiply of
an nsw addrec. While this is legal for nuw, this is not generally the
case for nsw.

This is because nsw mul does not distribute over nsw add:
https://alive2.llvm.org/ce/z/mergCt

Instead, we need either both nuw and nsw to be set
(https://alive2.llvm.org/ce/z/7wpgGc) or explicitly prove that the
distributed multiplications are also nsw
(https://alive2.llvm.org/ce/z/wef9su).

Fixes https://github.com/llvm/llvm-project/issues/66066.




More information about the All-commits mailing list