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

serguei-katkov via All-commits all-commits at lists.llvm.org
Thu Apr 6 20:49:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b86a06ef284f2637bef89bf5bb20157a8b195568
      https://github.com/llvm/llvm-project/commit/b86a06ef284f2637bef89bf5bb20157a8b195568
  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.

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