[PATCH] D60723: [EarlyCSE] detect equivalence of selects with inverse conditions and commuted operands (PR41101)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 10:11:30 PDT 2019


spatel created this revision.
spatel added reviewers: echristo, chandlerc, dlj, efriedma.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

This is 1 of the problems discussed in the post-commit thread for:
rL355741 <https://reviews.llvm.org/rL355741> / http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190311/635516.html
and filed as:
https://bugs.llvm.org/show_bug.cgi?id=41101

Instcombine tries to canonicalize some of these cases (and there's room for improvement there independently of this patch), but it can't always do that because of extra uses. So we need to recognize these commuted operand patterns here in EarlyCSE. This is similar to how we detect commuted compares and commuted min/max/abs.

The 2 patterns (inverted pred and 'not' cond) are independent, so I can commit those separately if this looks ok.


https://reviews.llvm.org/D60723

Files:
  llvm/lib/Transforms/Scalar/EarlyCSE.cpp
  llvm/test/Transforms/EarlyCSE/commute.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60723.195212.patch
Type: text/x-patch
Size: 6607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190415/acacd230/attachment.bin>


More information about the llvm-commits mailing list