This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Canonicalize `(X^(X-1)) u{ge,lt} X` as pow2 test
ClosedPublic

Authored by goldstein.w.n on Jun 11 2023, 11:28 PM.

Details

Summary

Also hoist the current canoniclizations from foldICmpEquality to
keep all the logic in the same place.
https://alive2.llvm.org/ce/z/T8osF6

Diff Detail

Event Timeline

goldstein.w.n created this revision.Jun 11 2023, 11:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2023, 11:28 PM
goldstein.w.n requested review of this revision.Jun 11 2023, 11:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2023, 11:28 PM
nikic added a comment.Jun 12 2023, 2:41 AM

Could you please split off the extraction of foldICmpPow2Test into an NFC patch (feel free to just commit it)?

Could you please split off the extraction of foldICmpPow2Test into an NFC patch (feel free to just commit it)?

Done.

Split off the factoring out

nikic accepted this revision.Jun 12 2023, 11:57 AM

LGTM

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
5000

format

This revision is now accepted and ready to land.Jun 12 2023, 11:57 AM
This revision was landed with ongoing or failed builds.Jul 21 2023, 12:15 PM
This revision was automatically updated to reflect the committed changes.