This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Add transforms for `(icmp eq/ne (trunc x),(truncOrZext(y)))`->`(icmp eq/ne x,y)`
Needs ReviewPublic

Authored by goldstein.w.n on Apr 17 2023, 5:33 PM.

Details

Summary

Three transforms (all commutative):

`(icmp eq/ne (trunc x),(trunc y))`:
    -> if `sizeof(x) == sizeof(y)`:
        -> `(icmp eq/ne x,y)`
            - https://alive2.llvm.org/ce/z/rAj52G
    -> if `sizeof(x) < sizeof(y)`:
        -> `(icmp eq/ne x,(trunc y)`
            - https://alive2.llvm.org/ce/z/vyju55
`(icmp eq/ne (trunc x),(zext y)`
        -> `(icmp eq/ne x,(zext y)`
            - https://alive2.llvm.org/ce/z/mtKZzm

Diff Detail

Event Timeline

goldstein.w.n created this revision.Apr 17 2023, 5:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 5:33 PM
goldstein.w.n requested review of this revision.Apr 17 2023, 5:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 5:33 PM

I think the third line in the commit message should be

-> (icmp eq/ne x,y)

?

goldstein.w.n edited the summary of this revision. (Show Details)Apr 18 2023, 12:37 AM

I think the third line in the commit message should be

-> (icmp eq/ne x,y)

?

Correct. Fixed summary. Thanks.