[PATCH] D124419: [InstCombine] try to fold icmp with mismatched extended operands

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 14:11:03 PDT 2022


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

If a value is known to be non-negative and zexted, that's the same thing as sexted.

So for the purpose of looking past the casts with an icmp, treat it as if it was a sext:
https://alive2.llvm.org/ce/z/_BDsGV

This is necessary, but not enough to solve the motivating problem:
https://github.com/llvm/llvm-project/issues/55013


https://reviews.llvm.org/D124419

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/test/Transforms/InstCombine/icmp-ext-ext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124419.425023.patch
Type: text/x-patch
Size: 8760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220425/86f5685a/attachment.bin>


More information about the llvm-commits mailing list