[PATCH] D159058: [InstCombine] Improve scope of `foldICmpWithLowBitMaskedVal`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 21:29:23 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, RKSimon, Allen.
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.

Changes are:

1. Also recognize the `(icmp eq/ne (and X, ~Mask), 0)` as equivilent to `(icmp eq/ne (and X, Mask), X`
  - https://alive2.llvm.org/ce/z/3u-usC
2. Cleanup / improve coverage of mask detection patterns.
  - https://alive2.llvm.org/ce/z/fSQ3nZ


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159058

Files:
  llvm/include/llvm/IR/PatternMatch.h
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ne-to-icmp-ugt.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ugt-to-icmp-ugt.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll
  llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ult-to-icmp-ugt.ll
  llvm/test/Transforms/InstCombine/icmp-and-lowbit-mask.ll
  llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll
  llvm/test/Transforms/InstCombine/lshr-and-signbit-icmpeq-zero.ll
  llvm/test/Transforms/InstCombine/shl-and-negC-icmpeq-zero.ll
  llvm/test/Transforms/InstCombine/shl-and-signbit-icmpeq-zero.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159058.554165.patch
Type: text/x-patch
Size: 34108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230829/61eced37/attachment.bin>


More information about the llvm-commits mailing list