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

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 17:33:35 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.

Three transforms (all commutative):

  `(icmp eq/ne (trunc x),(trunc y))`:
      -> if `sizeof(x) == sizeof(y)`:
          -> `(icmp eq/ne (trunc x),(trunc 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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148593

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/eq-of-parts.ll
  llvm/test/Transforms/InstCombine/icmp-of-trunc-ext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148593.514480.patch
Type: text/x-patch
Size: 7366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230418/2d5cbd0e/attachment.bin>


More information about the llvm-commits mailing list