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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 29 06:25:08 PST 2021


spatel added a comment.

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
  }



================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:876
 
     switch (improveShuffleKindFromMask(Kind, Mask)) {
     case TTI::SK_Broadcast:
----------------
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");


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