This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Improve eq/ne by parts to handle `ult/ugt` equality pattern.
Needs ReviewPublic

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

Details

Summary

(icmp eq/ne (lshr x, C), (lshr y, C) gets optimized to `(icmp
ult/uge (xor x, y), (1 << C)`. This can cause the current equal by
parts detection to miss the high-bits as it may get optimized to the
new pattern.

This commit adds support for detecting / combining the ult/ugt
pattern.

Diff Detail

Event Timeline

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

Note: I'm happy the drop this if you feel its not worth the complexity. Its mostly because D148593 causes a regression in the test without this change.