This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Canonicalize (icmp eq/ne X, rotate(X)) to always use rotate-left
ClosedPublic

Authored by goldstein.w.n on Jun 7 2023, 1:15 AM.

Details

Summary

We canonicalize rotate-right -> rotate-left in other places. Makes
sense to do so here as well.
Proof: https://alive2.llvm.org/ce/z/HL3TpK

Diff Detail

Event Timeline

goldstein.w.n created this revision.Jun 7 2023, 1:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2023, 1:15 AM
goldstein.w.n requested review of this revision.Jun 7 2023, 1:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2023, 1:15 AM
goldstein.w.n retitled this revision from [InstCombine] Transform (icmp eq/ne rotate(X,A0),rotate(X,A1)) -> (icmp eq/ne rotate(X,A0-A1)) to [InstCombine] Canonicalize (icmp eq/ne X, rotate(X)) to always use rotate-left.Jun 7 2023, 2:02 AM
goldstein.w.n edited the summary of this revision. (Show Details)

Use Builder.CreateIntrinsic

nikic accepted this revision.Jun 7 2023, 12:14 PM

LGTM

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
5053
This revision is now accepted and ready to land.Jun 7 2023, 12:14 PM