[PATCH] D94861: [InstCombine,InstSimplify] Optimize select followed by and/or/xor

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 16 03:31:49 PST 2021


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

This patch adds `A & (A && B)` -> `A && B`  (similarly for or + logical or)

Also, this patch adds `~(select C, (icmp pred X, Y), const)` -> `select C, (icmp pred' X, Y), ~const`.

Alive2 proof:
merge_and: https://alive2.llvm.org/ce/z/teMR97
merge_or: https://alive2.llvm.org/ce/z/b4yZUp
xor_and: https://alive2.llvm.org/ce/z/_-TXHi
xor_or: https://alive2.llvm.org/ce/z/2uYx_a


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94861

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/select-safe-transforms.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94861.317163.patch
Type: text/x-patch
Size: 6820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210116/27a8b0bc/attachment.bin>


More information about the llvm-commits mailing list