[all-commits] [llvm/llvm-project] 624973: [InstCombine] Add support for max(a, b) + min(a, b) ...

serguei-katkov via All-commits all-commits at lists.llvm.org
Thu Apr 6 22:07:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 624973806c5644ccfa84805319b5852edb68d48d
      https://github.com/llvm/llvm-project/commit/624973806c5644ccfa84805319b5852edb68d48d
  Author: Serguei Katkov <serguei.katkov at azul.com>
  Date:   2023-04-07 (Fri, 07 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/add-min-max.ll
    M llvm/test/Transforms/InstCombine/mul-min-max.ll

  Log Message:
  -----------
  [InstCombine] Add support for max(a,b) + min(a,b) => a + b. Re-land.

The same optimization for
  max(a,b) * min(a,b) => a * b
is added.

Correctness check:
uadd: https://alive2.llvm.org/ce/z/2rXDek
sadd: https://alive2.llvm.org/ce/z/zNu_er
uadd + nuw/nsw: https://alive2.llvm.org/ce/z/EaiNjB
sadd + nuw/nsw: https://alive2.llvm.org/ce/z/w_2Nrs

umul: https://alive2.llvm.org/ce/z/dgXRLr
smul: https://alive2.llvm.org/ce/z/hBjGzz
umul + nuw/nsw: https://alive2.llvm.org/ce/z/EaiNjB
smul + nuw/nsw: https://alive2.llvm.org/ce/z/87MNeS

Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D147296




More information about the All-commits mailing list