[all-commits] [llvm/llvm-project] 1fc73c: [InstCombine] Propagate nsw flag when negating

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Sep 14 00:10:03 PDT 2023


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
    M llvm/test/Transforms/InstCombine/abs-intrinsic.ll
    M llvm/test/Transforms/InstCombine/mul.ll
    M llvm/test/Transforms/InstCombine/nsw.ll

  Log Message:
  -----------
  [InstCombine] Propagate nsw flag when negating

When pushing a sub nsw 0, %x negation into an expression, try to
preserve the nsw flag for the cases where this is possible. Do this
by passing the flag through recursive Negator::negate() calls.

Proofs: https://alive2.llvm.org/ce/z/oRPNcY

Differential Revision: https://reviews.llvm.org/D158510




More information about the All-commits mailing list