This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Make the `(icmp eq/ne (and X, Y), X)` canonicalization work for non-const operands
AbandonedPublic

Authored by goldstein.w.n on Aug 28 2023, 9:29 PM.

Details

Summary

We currently do:

`(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (and ~X, Y), 0)`

if X is constant. We can make this more general and do it if X is
freely invertable (i.e say X = ~Z).

As well, we can also do:

`(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (or X, ~Y), -1)`

If Y is freely invertible.

Proofs: https://alive2.llvm.org/ce/z/yeWH3E

Diff Detail

Event Timeline

goldstein.w.n created this revision.Aug 28 2023, 9:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2023, 9:29 PM
goldstein.w.n requested review of this revision.Aug 28 2023, 9:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2023, 9:29 PM
goldstein.w.n abandoned this revision.Sep 19 2023, 9:10 AM

Abandoning and resubmitting on GH