This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Support BitTests in ThreeWayComparison. General case, part 2
AbandonedPublic

Authored by mkazantsev on Apr 19 2018, 6:37 PM.

Details

Summary

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 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

which is an alternative to

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

which applies if (%Less - %Greater) & %Greater == 0.

This is a part of fix of the bug 37147.

Diff Detail

Event Timeline

Please upload all patches with the full context (-U99999).

Added context

Formatted tests.

mkazantsev planned changes to this revision.Apr 23 2018, 10:28 PM

We will try another approach to deal with the problem, see discussion in review of D45862.

mkazantsev requested review of this revision.Apr 27 2018, 7:44 PM
mkazantsev abandoned this revision.May 2 2018, 6:45 PM

Abandoning in favour of D46086