[PATCH] D81500: [SVE] Remove calls to VectorType::getNumElements from IR

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 03:41:17 PDT 2020


RKSimon added a comment.

a few minors - you might also want to keep an eye on D85794 <https://reviews.llvm.org/D85794>



================
Comment at: llvm/lib/IR/Constants.cpp:233
     return false;
-  for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
+  for (unsigned i = 0, e = cast<FixedVectorType>(VTy)->getNumElements(); i != e;
+       ++i) {
----------------
I think you can change the VTy cast without changing functionality here.


================
Comment at: llvm/lib/IR/Constants.cpp:310
   if (auto *VTy = dyn_cast<VectorType>(getType())) {
-    for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
+    for (unsigned i = 0, e = cast<FixedVectorType>(VTy)->getNumElements();
+         i != e; ++i)
----------------
I think you can change the VTy cast without changing functionality here.


================
Comment at: llvm/lib/IR/Constants.cpp:321
   if (auto *VTy = dyn_cast<VectorType>(getType())) {
-    for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
+    for (unsigned i = 0, e = cast<FixedVectorType>(VTy)->getNumElements();
+         i != e; ++i)
----------------
I think you can change the VTy cast without changing functionality here.


================
Comment at: llvm/lib/IR/Verifier.cpp:5254
       auto *ResultVecTy = cast<VectorType>(ResultTy);
-      Assert(OperandVecTy->getNumElements() == ResultVecTy->getNumElements(),
+      Assert(cast<FixedVectorType>(OperandVecTy)->getNumElements() ==
+                 cast<FixedVectorType>(ResultVecTy)->getNumElements(),
----------------
I think you can lose the cast<VectorType> lines and not lose any functionality here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81500



More information about the llvm-commits mailing list