[PATCH] D45855: [InstCombine] Support BitTests in ThreeWayComparison. General case, part 1

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 18:34:45 PDT 2018


mkazantsev created this revision.
mkazantsev added reviewers: craig.topper, lebedev.ri, spatel, reames.

In this patch we continue supporting BitTests of the highest bit in the ThreeWayComparison
matcher in the InstCombine (see problem's description in the message of https://reviews.llvm.org/D45854).

This patch adds support for the transform of

  %c2 = icmp slt %a, 0
  %select1 = select %c2, %Less, %Greater

to

  (%a s>> 31) - (%Less - %Greater) + Greater

This is a part of fix of the bug 37147.


https://reviews.llvm.org/D45855

Files:
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  test/Transforms/InstCombine/three-way-comparison.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45855.143209.patch
Type: text/x-patch
Size: 3422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180420/6dd0b283/attachment.bin>


More information about the llvm-commits mailing list