[PATCH] D73575: [InstCombine] canonicalize splat shuffle after cmp

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 12:35:16 PST 2020


spatel created this revision.
spatel added reviewers: nikic, lebedev.ri, efriedma.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

cmp (splat V1, M), SplatC --> splat (cmp V1, SplatC'), M

As discussed in PR44588:
https://bugs.llvm.org/show_bug.cgi?id=44588
...we try harder to push shuffles after binops than after compares.

This patch handles the special (but presumably most common case) of splat shuffles. If both operands are splats, then we can do the comparison on the non-splat inputs followed by splat of the compare. That should take care of the regression noted in D73411 <https://reviews.llvm.org/D73411>.

There's another potential fold requested in PR37463 to scalarize the compare, but that's another patch (and it's not clear if we can do that without the ability to undo it later):
https://bugs.llvm.org/show_bug.cgi?id=37463


https://reviews.llvm.org/D73575

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/gep-inbounds-null.ll
  llvm/test/Transforms/InstCombine/getelementptr.ll
  llvm/test/Transforms/InstCombine/icmp-vec.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73575.240971.patch
Type: text/x-patch
Size: 7891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200128/11c559f6/attachment-0001.bin>


More information about the llvm-commits mailing list