[PATCH] D91755: [GlobalISel] Combine icmp eq/ne (ext (icmp cc, x, y)), true/false)

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 16:44:01 PST 2020


paquette created this revision.
paquette added reviewers: aemerson, arsenm.
Herald added subscribers: hiraditya, rovka.
Herald added a project: LLVM.
paquette requested review of this revision.
Herald added a subscriber: wdng.

This implements the following combines:

  icmp ne ([sz]ext (icmp cc, x, y)), 0) -> icmp cc, x, y
  icmp eq, ([sz]ext (icmp cc x, y)), 0) -> icmp inv(cc), x, y
  icmp ne, (zext (icmp cc, x, y)), 1) -> icmp inv(cc), x, y
  icmp eq, (zext (icmp cc, x, y)), 1) -> icmp cc, x, y
  icmp ne, (sext (icmp cc, x, y)), -1) -> icmp inv(cc), x, y
  icmp eq, (sext (icmp cc, x, y)), -1) -> icmp cc, x, y

This is similar to a combine in `TargetLowering::SimplifySetCC`.

IR example: https://godbolt.org/z/qzx81v


https://reviews.llvm.org/D91755

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-ext-icmp.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91755.306262.patch
Type: text/x-patch
Size: 21058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201119/80701106/attachment.bin>


More information about the llvm-commits mailing list