[PATCH] D82211: [SVE] Remove calls to VectorType::getNumElements from ExecutionEngine

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 19 10:19:28 PDT 2020


ctetreau created this revision.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82211

Files:
  llvm/lib/ExecutionEngine/ExecutionEngine.cpp


Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -627,7 +627,7 @@
       case Type::FixedVectorTyID:
       case Type::ScalableVectorTyID:
         // if the whole vector is 'undef' just reserve memory for the value.
-        auto *VTy = cast<VectorType>(C->getType());
+        auto *VTy = cast<FixedVectorType>(C->getType());
         Type *ElemTy = VTy->getElementType();
         unsigned int elemNum = VTy->getNumElements();
         Result.AggregateVal.resize(elemNum);
@@ -927,9 +927,9 @@
         elemNum = CDV->getNumElements();
         ElemTy = CDV->getElementType();
     } else if (CV || CAZ) {
-        auto* VTy = cast<VectorType>(C->getType());
-        elemNum = VTy->getNumElements();
-        ElemTy = VTy->getElementType();
+      auto *VTy = cast<FixedVectorType>(C->getType());
+      elemNum = VTy->getNumElements();
+      ElemTy = VTy->getElementType();
     } else {
         llvm_unreachable("Unknown constant vector type!");
     }
@@ -1100,7 +1100,8 @@
   }
   case Type::FixedVectorTyID:
   case Type::ScalableVectorTyID: {
-    auto *VT = cast<VectorType>(Ty);
+    // FIXME: this needs to handle scalable vectors correctly
+    auto *VT = cast<FixedVectorType>(Ty);
     Type *ElemT = VT->getElementType();
     const unsigned numElems = VT->getNumElements();
     if (ElemT->isFloatTy()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82211.272126.patch
Type: text/x-patch
Size: 1495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200619/d5c435d2/attachment.bin>


More information about the llvm-commits mailing list