[TTI] Fix uses of SK_ExtractSubvector shuffle costs (PR39368)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 30 Oct 2018 18:10:02 +0000 (18:10 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 30 Oct 2018 18:10:02 +0000 (18:10 +0000)
commit44a9a71d2a915bc25d880428927d4f1b6372d62e
tree482a09c570433eda5c306e78c402ca7cdf0cf58a
parent5a672b22e8a4efd22f5683f1c1628fb08e32d3a9
[TTI] Fix uses of SK_ExtractSubvector shuffle costs (PR39368)

Correct costings of SK_ExtractSubvector requires the SubTy argument to indicate the type/size of the extracted subvector.

Unlike the rest of the shuffle kinds this means that the main Ty argument represents the source vector type not the destination!

I've done my best to fix a number of vectorizer uses:

SLP - the reduction epilogue costs should be using a SK_PermuteSingleSrc shuffle as these all occur at the hardware vector width - we're not extracting (illegal) subvector types. This is causing the cost model diffs as SK_ExtractSubvector costs are poorly handled and tend to just return 1 at the moment.

LV - I'm not clear on what the SK_ExtractSubvector should represents for recurrences - I've used a <1 x ?> subvector extraction as that seems to match the VF delta.

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

llvm-svn: 345617
14 files changed:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Analysis/CostModel/AArch64/vector-reduce.ll
llvm/test/Analysis/CostModel/X86/reduce-add.ll
llvm/test/Analysis/CostModel/X86/reduce-and.ll
llvm/test/Analysis/CostModel/X86/reduce-mul.ll
llvm/test/Analysis/CostModel/X86/reduce-or.ll
llvm/test/Analysis/CostModel/X86/reduce-smax.ll
llvm/test/Analysis/CostModel/X86/reduce-smin.ll
llvm/test/Analysis/CostModel/X86/reduce-umax.ll
llvm/test/Analysis/CostModel/X86/reduce-umin.ll
llvm/test/Analysis/CostModel/X86/reduce-xor.ll
llvm/test/Analysis/CostModel/X86/reduction.ll