[PATCH] D104809: [SLPVectorizer] Fix crash in vectorizeChainsInBlock for scalable vector.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 09:07:48 PDT 2021


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2682
+      isa<ScalableVectorType>(
+          cast<ExtractElementInst>(S.OpValue)->getOperand(0)->getType())) {
+    LLVM_DEBUG(dbgs() << "SLP: Gathering due to scalable vector type.\n");
----------------
`cast<ExtractElementInst>(S.OpValue)->getVectorOperandType()`


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3750
     if (E->getOpcode() == Instruction::ExtractElement && allSameType(VL) &&
         allSameBlock(VL)) {
       // Check that gather of extractelements can be represented as just a
----------------
I would just add a check here `&& !isa<ScalableVectorType>(cast<ExtractElementInst>(E->getMainOp())->getVectorOperandType())` and drop changes in lines 3754-3760


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3757
+                                      ->getVectorOperandType()))
+        ShuffleKind = isGatherShuffledEntry(E, Mask, Entries);
+      else
----------------
No need to call it again, it is called already in line 3721


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104809



More information about the llvm-commits mailing list