[PATCH] D148591: [InstCombine] Improve eq/ne by parts to handle `ult/ugt` equality pattern.

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 17:32:52 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, spatel, majnemer.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

`(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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148591

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/eq-of-parts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148591.514478.patch
Type: text/x-patch
Size: 4517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230418/01499190/attachment.bin>


More information about the llvm-commits mailing list