[PATCH] D81504: [SVE] Remove calls to VectorType::getNumElements from Analysis

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 10:45:49 PDT 2020


RKSimon added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:111
 
   if (auto *VTy = dyn_cast<VectorType>(C->getType())) {
     // Handle a vector->scalar integer/fp cast.
----------------
Just use FixedVectorType in the dyn_cast here?


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:141
   // The code below only handles casts to vectors currently.
   auto *DestVTy = dyn_cast<VectorType>(DestTy);
   if (!DestVTy)
----------------
dyn_cast<FixedVectorType> ?


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:950
   if (Op1C && VTy) {
-    unsigned NumElts = VTy->getNumElements();
+    unsigned NumElts = cast<FixedVectorType>(VTy)->getNumElements();
     for (unsigned i = 0; i != NumElts; ++i) {
----------------
VTy is already FixedVectorType?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:3486
   // try to handle fixed width vector constants
   if (isa<FixedVectorType>(V->getType()) && isa<Constant>(V)) {
     // For vectors, verify that each element is not infinity.
----------------
use a dyn_cast<> so we don't have a isa<> and a cast<>


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:3590
   // Try to handle fixed width vector constants
   if (isa<FixedVectorType>(V->getType()) && isa<Constant>(V)) {
     // For vectors, verify that each element is not NaN.
----------------
use a dyn_cast<> so we don't have a isa<> and a cast<>


================
Comment at: llvm/lib/Analysis/VectorUtils.cpp:815
   VectorType *VecTy1 = dyn_cast<VectorType>(V1->getType());
   VectorType *VecTy2 = dyn_cast<VectorType>(V2->getType());
   assert(VecTy1 && VecTy2 &&
----------------
dyn_cast<FixedVectorType>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81504





More information about the llvm-commits mailing list