[PATCH] D86898: [SVE] Remove calls to VectorType::getNumElements() from llvm-stress

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 15:46:47 PDT 2020


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

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86898

Files:
  llvm/tools/llvm-stress/llvm-stress.cpp


Index: llvm/tools/llvm-stress/llvm-stress.cpp
===================================================================
--- llvm/tools/llvm-stress/llvm-stress.cpp
+++ llvm/tools/llvm-stress/llvm-stress.cpp
@@ -237,7 +237,7 @@
         return ConstantFP::getAllOnesValue(Tp);
       return ConstantFP::getNullValue(Tp);
     } else if (Tp->isVectorTy()) {
-      VectorType *VTp = cast<VectorType>(Tp);
+      auto *VTp = cast<FixedVectorType>(Tp);
 
       std::vector<Constant*> TempValues;
       TempValues.reserve(VTp->getNumElements());
@@ -482,10 +482,13 @@
 
   void Act() override {
     Value *Val0 = getRandomVectorValue();
-    Value *V = ExtractElementInst::Create(Val0,
-             ConstantInt::get(Type::getInt32Ty(BB->getContext()),
-             getRandom() % cast<VectorType>(Val0->getType())->getNumElements()),
-             "E", BB->getTerminator());
+    Value *V = ExtractElementInst::Create(
+        Val0,
+        ConstantInt::get(
+            Type::getInt32Ty(BB->getContext()),
+            getRandom() %
+                cast<FixedVectorType>(Val0->getType())->getNumElements()),
+        "E", BB->getTerminator());
     return PT->push_back(V);
   }
 };
@@ -498,7 +501,7 @@
     Value *Val0 = getRandomVectorValue();
     Value *Val1 = getRandomValue(Val0->getType());
 
-    unsigned Width = cast<VectorType>(Val0->getType())->getNumElements();
+    unsigned Width = cast<FixedVectorType>(Val0->getType())->getNumElements();
     std::vector<Constant*> Idxs;
 
     Type *I32 = Type::getInt32Ty(BB->getContext());
@@ -526,10 +529,13 @@
     Value *Val0 = getRandomVectorValue();
     Value *Val1 = getRandomValue(Val0->getType()->getScalarType());
 
-    Value *V = InsertElementInst::Create(Val0, Val1,
-              ConstantInt::get(Type::getInt32Ty(BB->getContext()),
-              getRandom() % cast<VectorType>(Val0->getType())->getNumElements()),
-              "I",  BB->getTerminator());
+    Value *V = InsertElementInst::Create(
+        Val0, Val1,
+        ConstantInt::get(
+            Type::getInt32Ty(BB->getContext()),
+            getRandom() %
+                cast<FixedVectorType>(Val0->getType())->getNumElements()),
+        "I", BB->getTerminator());
     return PT->push_back(V);
   }
 };
@@ -545,7 +551,7 @@
 
     // Handle vector casts vectors.
     if (VTy->isVectorTy()) {
-      VectorType *VecTy = cast<VectorType>(VTy);
+      auto *VecTy = cast<FixedVectorType>(VTy);
       DestTy = pickVectorType(VecTy->getNumElements());
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86898.289036.patch
Type: text/x-patch
Size: 2497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200831/3590b4ef/attachment.bin>


More information about the llvm-commits mailing list