[PATCH] D48830: [InstCombine] fold shuffle-with-binop and common value
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 2 06:59:56 PDT 2018
spatel created this revision.
spatel added reviewers: lebedev.ri, RKSimon, efriedma.
Herald added a subscriber: mcrosier.
This is the last significant change suggested in PR37806:
https://bugs.llvm.org/show_bug.cgi?id=37806#c5
...though there are several follow-ups suggested in the code comments in this patch to complete this transform.
It's possible that a binop feeding a select-shuffle has been eliminated by earlier transforms (or the code was just written like this in the 1st place), so we'll fail to match the patterns that have 2 binops from https://reviews.llvm.org/D48401, https://reviews.llvm.org/D48678, https://reviews.llvm.org/D48662, https://reviews.llvm.org/D48485.
In that case, we can try to materialize identity constants for the remaining binop to fill in the "ghost" lanes of the vector (where we just want to pass through the original values of the source operand).
I added comments to ConstantExpr::getBinOpIdentity() to show planned follow-ups. For now, we only handle the 5 commutative integer binops (add/mul/and/or/xor).
https://reviews.llvm.org/D48830
Files:
lib/IR/Constants.cpp
lib/Transforms/InstCombine/InstCombineVectorOps.cpp
test/Transforms/InstCombine/shuffle_select.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48830.153707.patch
Type: text/x-patch
Size: 5630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180702/e649e61a/attachment.bin>
More information about the llvm-commits
mailing list