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

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 03:12:57 PST 2022


sdesmalen added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:878-880
+      if (!isa<FixedVectorType>(Tp))
+        return InstructionCost::getInvalid();
       return getBroadcastShuffleOverhead(cast<FixedVectorType>(Tp));
----------------
nit: is it worth writing this as:

  if (auto *FVT = dyn_cast<FixedVectorType>(Tp))
    return getBroadcastShuffleOverhead(FVT);
  return InstructionCost::getInvalid()




================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:887
     case TTI::SK_PermuteTwoSrc:
+      if (!isa<FixedVectorType>(Tp))
+        return InstructionCost::getInvalid();
----------------
(same suggestion here)


================
Comment at: llvm/test/Analysis/CostModel/RISCV/rvv-shuffle.ll:4
+
+; RUN: opt -cost-model -analyze -mtriple=riscv64 -mattr=+m,+experimental-v -scalable-vectorization=on  < %s | FileCheck %s
+
----------------
nit: `-scalable-vectorization=off|on` is an option to the LoopVectorizer, not the costmodel, so it won't have any effect when combined with `-cost-model -analyze`


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