Page MenuHomePhabricator

[InstCombine] Add transforms for `(icmp upred (or X, Y), X)`
Needs ReviewPublic

Authored by goldstein.w.n on Feb 22 2023, 5:20 PM.

Details

Summary

We can simplify ule/ugt -> eq/ne and we can remove the xor in some
cases of eq/ne.

icmp (X | Y) u<= X --> (X | Y) == X

icmp (X | Y) u> X --> (X | Y) != X

icmp (X | noundef Y) eq/ne X --> (X & noundef Y) eq/ne noundef Y

Diff Detail

Event Timeline

goldstein.w.n created this revision.Feb 22 2023, 5:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2023, 5:20 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Feb 22 2023, 5:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2023, 5:20 PM

Split into two patch + helper

goldstein.w.n retitled this revision from [InstCombine] Add transforms for `(icmp (xor X, Y), X)` to [InstCombine] Add transforms for `(icmp upred (or X, Y), X)`.Fri, Mar 3, 4:01 PM
goldstein.w.n edited the summary of this revision. (Show Details)
goldstein.w.n edited the summary of this revision. (Show Details)

Rebase

Swap operands so op0 is always or for cleaner logic