[PATCH] D119851: [InstCombine] push constant operand up/inside in sequence of min/max intrinsics

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 08:31:34 PST 2022


spatel created this revision.
spatel added reviewers: lebedev.ri, nikic, 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>, but I'm proposing to move the constant up rather than down.

If these operations ever graduate to become real instructions rather than intrinsics, then this would not conflict with the reassociate pass because it has the same transform in its set of tricks for binop instructions.

The line between the passes on these kinds of folds is blurry, but this doesn't appear to have much cost and gives us the expected wins from repeated folds as seen in the last pair of test diffs.


https://reviews.llvm.org/D119851

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119851.408879.patch
Type: text/x-patch
Size: 6845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220215/15eb868c/attachment.bin>


More information about the llvm-commits mailing list