[PATCH] D46086: [InstCombine] refine select-of-constants to bitwise ops

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 25 14:35:04 PDT 2018


spatel created this revision.
spatel added reviewers: mkazantsev, efriedma, lebedev.ri.
Herald added subscribers: kristof.beyls, mcrosier.
Herald added a reviewer: javed.absar.

This is an enhancement to the proposal at https://reviews.llvm.org/D45862 where we add logic for the special case when a cmp+select can clearly be reduced to just a bitwise logic instruction. The goal is to remove cases where we are not improving the IR instruction count when doing these select transforms, and in all cases here that is true.

I think this will have the same results on the 3-way compare tests that are proposed in the other patch. We should commit those first, so we can see the diffs here or in the other patch.

I looked some at x86 and AArch64 codegen with this change, and we're going to get more cmov/vblend and csel/bsl because the DAG doesn't have replacements for all of these folds. In some cases, the changes look better and others it seems worse, but I suspect we'll have to run detailed perf tests per uarch to know the true perf outcome.


https://reviews.llvm.org/D46086

Files:
  lib/Transforms/InstCombine/InstCombineSelect.cpp
  test/Transforms/InstCombine/rem.ll
  test/Transforms/InstCombine/select-icmp-and.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46086.144003.patch
Type: text/x-patch
Size: 23956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180425/a61e4df6/attachment.bin>


More information about the llvm-commits mailing list