[all-commits] [llvm/llvm-project] 3ecf73: [InstCombine] Reduce absolute diff from min+max+sub

Jun Zhang via All-commits all-commits at lists.llvm.org
Thu Mar 9 16:01:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3ecf731376cb4661d85c10932bd7bd7c11998ad8
      https://github.com/llvm/llvm-project/commit/3ecf731376cb4661d85c10932bd7bd7c11998ad8
  Author: Jun Zhang <jun at junz.org>
  Date:   2023-03-10 (Fri, 10 Mar 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/sub-minmax.ll

  Log Message:
  -----------
  [InstCombine] Reduce absolute diff from min+max+sub

This patch implements fold: max(a,b) nsw/nuw - min(a,b) --> abs(a nsw - b)

Alive2: https://alive2.llvm.org/ce/z/4yLp7D
Fixes: https://github.com/llvm/llvm-project/issues/61228

Signed-off-by: Jun Zhang <jun at junz.org>

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




More information about the All-commits mailing list