[llvm] 78aa260 - [NFC] Fix unused result of dyn_cast<VectorType> in non-assert build

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 06:58:24 PDT 2020


Author: Sander de Smalen
Date: 2020-04-22T14:57:28+01:00
New Revision: 78aa260df742bc1fbe252bffdb7a1da0613ef116

URL: https://github.com/llvm/llvm-project/commit/78aa260df742bc1fbe252bffdb7a1da0613ef116
DIFF: https://github.com/llvm/llvm-project/commit/78aa260df742bc1fbe252bffdb7a1da0613ef116.diff

LOG: [NFC] Fix unused result of dyn_cast<VectorType> in non-assert build

Added: 
    

Modified: 
    llvm/lib/IR/Constants.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index 338029fa00de..b86b747f7519 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1895,8 +1895,8 @@ Constant *ConstantExpr::getPtrToInt(Constant *C, Type *DstTy,
   assert(DstTy->isIntOrIntVectorTy() &&
          "PtrToInt destination must be integer or integer vector");
   assert(isa<VectorType>(C->getType()) == isa<VectorType>(DstTy));
-  if (auto *CVTy = dyn_cast<VectorType>(C->getType()))
-    assert(CVTy->getNumElements() ==
+  if (isa<VectorType>(C->getType()))
+    assert(cast<VectorType>(C->getType())->getNumElements() ==
                cast<VectorType>(DstTy)->getNumElements() &&
            "Invalid cast between a 
diff erent number of vector elements");
   return getFoldedCast(Instruction::PtrToInt, C, DstTy, OnlyIfReduced);
@@ -1909,8 +1909,8 @@ Constant *ConstantExpr::getIntToPtr(Constant *C, Type *DstTy,
   assert(DstTy->isPtrOrPtrVectorTy() &&
          "IntToPtr destination must be a pointer or pointer vector");
   assert(isa<VectorType>(C->getType()) == isa<VectorType>(DstTy));
-  if (auto *CVTy = dyn_cast<VectorType>(C->getType()))
-    assert(CVTy->getNumElements() ==
+  if (isa<VectorType>(C->getType()))
+    assert(cast<VectorType>(C->getType())->getNumElements() ==
                cast<VectorType>(DstTy)->getNumElements() &&
            "Invalid cast between a 
diff erent number of vector elements");
   return getFoldedCast(Instruction::IntToPtr, C, DstTy, OnlyIfReduced);


        


More information about the llvm-commits mailing list