[PATCH] D94860: [InstCombine] Optimize select (X == C), (icmp X Y), false

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 16 02:56:02 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 transformation `select (X == C), (icmp X Y), false` ->
`select (X == C), (icmp C Y), false`.

After the select i1 -> and/or transformation is removed, this optimization
should be explicitly added as a select transformation.
This pattern seems quite common in Transforms/InstCombine.

Alive2 proof:
And: https://alive2.llvm.org/ce/z/dVoKnd
Or: https://alive2.llvm.org/ce/z/3hb9qS


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94860

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/test/Transforms/InstCombine/select-safe-transforms.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94860.317162.patch
Type: text/x-patch
Size: 6870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210116/1be19af5/attachment.bin>


More information about the llvm-commits mailing list