[PATCH] D145540: [InstCombine] Reduce absolute diff from min+max+sub

Jun Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 19:34:28 PST 2023


junaire created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
junaire requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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

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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145540

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/test/Transforms/InstCombine/sub-minmax.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145540.503213.patch
Type: text/x-patch
Size: 14898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230308/de38574b/attachment.bin>


More information about the llvm-commits mailing list