[PATCH] D87550: [SLPVectorizer][SVE] Avoid blind cast to FixedVectorType in getAggregateSize.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 10:11:21 PDT 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7079
 static Optional<unsigned> getAggregateSize(Instruction *InsertInst) {
-  if (auto *IE = dyn_cast<InsertElementInst>(InsertInst))
-    return cast<FixedVectorType>(IE->getType())->getNumElements();
+  if (auto *IE = dyn_cast<InsertElementInst>(InsertInst)) {
+    auto *FVTy = dyn_cast<FixedVectorType>(IE->getType());
----------------
I'm a bit concerned that this issue shows up so late in this pass. By the time it gets to this function, I believe we should be able to guarantee that the `InsertElementInst` is performed on a `FixedVectorType`. When `vectorizeSimpleInstructions` gets called, the list of `Instructions` should not contain any scalable-vector instructions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87550



More information about the llvm-commits mailing list