[PATCH] D119754: [InstCombine] reassociate min/max intrinsics with constant operands

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 11:46:34 PST 2022


spatel created this revision.
spatel added reviewers: nikic, RKSimon.
Herald added subscribers: hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Integer min/max operations are associative:
max (max X, C0), C1 <https://reviews.llvm.org/C1> --> max X, (max C0, C1 <https://reviews.llvm.org/C1>) --> max X, NewC

https://alive2.llvm.org/ce/z/wW5HVM

This would avoid a regression when we canonicalize to min/max intrinsics (see D98152 <https://reviews.llvm.org/D98152> ).


https://reviews.llvm.org/D119754

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/Transforms/InstCombine/minmax-intrinsics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119754.408522.patch
Type: text/x-patch
Size: 4476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220214/005f0cac/attachment.bin>


More information about the llvm-commits mailing list