[PATCH] D119955: [InstCombine] push constant operand down/outside in sequence of min/max intrinsics

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 09:15:48 PST 2022


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

A generalization like this was suggested in D119754 <https://reviews.llvm.org/D119754>. This is the inverse direction of D119851 <https://reviews.llvm.org/D119851>, and we get all of the folds there plus the one that was missed.

There is precedence for this kind of transform in instcombine with "or" instructions (but strangely only with that one opcode AFAICT).

Similar justification as in the other patch: 
The line between instcombine and reassociate for these kinds of folds is blurry. This doesn't appear to have much cost and gives us the expected wins from repeated folds as seen in the last set of test diffs.


https://reviews.llvm.org/D119955

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119955.409287.patch
Type: text/x-patch
Size: 6682 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/75fb30de/attachment-0001.bin>


More information about the llvm-commits mailing list