[PATCH] D77272: Clean up usages of asserting vector getters in Type
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 07:30:00 PDT 2020
sdesmalen added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:85
unsigned getBroadcastShuffleOverhead(Type *Ty) {
- assert(Ty->isVectorTy() && "Can only shuffle vectors");
+ auto *VTy = dyn_cast<VectorType>(Ty);
+ assert(VTy && "Can only shuffle vectors");
----------------
Can we just use `cast<>` and get rid of the separate assert below? We'd lose the message, but I'm not sure how useful that is, given that the context makes it quite obvious.
================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:104
+ auto *VTy = dyn_cast<VectorType>(Ty);
+ assert(VTy && "Can only shuffle vectors");
unsigned Cost = 0;
----------------
same here.
================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:629
unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
- assert(VecTy->isVectorTy());
+ auto *VecVTy = cast<VectorType>(VecTy);
----------------
nit: Move this line closer to definition on 633?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77272/new/
https://reviews.llvm.org/D77272
More information about the llvm-commits
mailing list