[PATCH] D113510: [InstCombine] Strip offset when folding and/or of icmps

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 9 13:13:15 PST 2021


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When folding and/or of icmps, look through add of a constant and adjust the icmp range instead. Effectively, this decomposes `X + C1 < C2` style range checks back into a normal range. This allows us to fold comparisons involving two range checks or one range check and some other condition. We had a fold for a really specific case of this (or of range check and eq, and only one one side!) while this handles it in fully generality.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113510

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/and-or-icmps.ll
  llvm/test/Transforms/InstCombine/or.ll
  llvm/test/Transforms/InstCombine/signed-truncation-check.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113510.385949.patch
Type: text/x-patch
Size: 10665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211109/0d63b9d3/attachment.bin>


More information about the llvm-commits mailing list