[PATCH] D116362: [TTI] Support ScalableVectorType in getShuffleCost with SK_Broadcast kind

JunMa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 29 18:54:46 PST 2021


junparser added a comment.

In D116362#3212562 <https://reviews.llvm.org/D116362#3212562>, @spatel wrote:

> It's fine to have a vectorizer test, but it would be better to have a more direct test of the cost model itself.
>
> I think something like this can check for the crash (we could add variations to see if the cost is actually accurate - see `/llvm/test/Analysis/CostModel/AArch64/sve-shuffle-broadcast.ll` for an existing test model):
>
>   ; RUN: opt -cost-model -analyze -mtriple=riscv64 -mattr=+m,+experimental-v -scalable-vectorization=on  < %s | FileCheck %s
>   
>   define void @broadcast() {
>     %zero = shufflevector <vscale x 16 x i8> undef, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
>     ret void
>   }

good point,  I missed this because of that rv does not have such target api. I'll add it.



================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:876
 
     switch (improveShuffleKindFromMask(Kind, Mask)) {
     case TTI::SK_Broadcast:
----------------
spatel wrote:
> Can we assert that the Type is Fixed unless the shuffle is a broadcast?
>   assert((ImprovedKind == TTI::SK_Broadcast || isa<FixedVectorType>(Tp)) && "Unexpected shuffle of scalable vector");
yes,we can.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116362/new/

https://reviews.llvm.org/D116362



More information about the llvm-commits mailing list