[PATCH] D149229: [InstSimplify] with logical ops: (X & Y) == -1 ? X : -1 --> -1

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 20:08:07 PDT 2023


Allen created this revision.
Allen added reviewers: nikic, RKSimon, spatel, floatshadow.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
Allen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Use simplifySelectWithICmpEq to handle the implied equalities from the icmp-and,
then both of ICMP_NE and ICMP_EQ will be addressed including vector type.

  (X & Y) == -1 ?  X : -1 --> -1 (commuted 2 ways)
  (X & Y) != -1 ? -1 :  X --> -1 (commuted 2 ways)

This is a supplement to the icmp-or scenario on D148986 <https://reviews.llvm.org/D148986>.


https://reviews.llvm.org/D149229

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/test/Transforms/InstSimplify/select_or_and.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149229.517032.patch
Type: text/x-patch
Size: 5017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230426/850bf94b/attachment.bin>


More information about the llvm-commits mailing list