]> granicus.if.org Git - llvm/commit
[SLPVectorizer] Add initial alternate opcode support for cast instructions. (REAPPLIED)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 11 Jul 2018 15:05:10 +0000 (15:05 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 11 Jul 2018 15:05:10 +0000 (15:05 +0000)
commit33f4d61062ff9fbbbb5859019ac73a1153d7de7c
treeb71bb2f0a151881494fb7b353e2ab7e2439de4b7
parent96954e8f95af0d81209c9d9715df96f22d11ffe6
[SLPVectorizer] Add initial alternate opcode support for cast instructions. (REAPPLIED)

We currently only support binary instructions in the alternate opcode shuffles.

This patch is an initial attempt at adding cast instructions as well, this raises several issues that we probably want to address as we continue to generalize the alternate mechanism:

1 - Duplication of cost determination - we should probably add scalar/vector costs helper functions and get BoUpSLP::getEntryCost to use them instead of determining costs directly.
2 - Support alternate instructions with the same opcode (e.g. casts with different src types) - alternate vectorization of calls with different IntrinsicIDs will require this.
3 - Allow alternates to be a different instruction type - mixing binary/cast/call etc.
4 - Allow passthrough of unsupported alternate instructions - related to PR30787/D28907 'copyable' elements.

Reapplied with fix to only accept 2 different casts if they come from the same source type.

Differential Revision: https://reviews.llvm.org/D49135

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336812 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/SLPVectorizer.cpp
test/Transforms/SLPVectorizer/X86/alternate-cast.ll