diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 338029fa00de14..b86b747f751902 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(C->getType()) == isa(DstTy)); - if (auto *CVTy = dyn_cast(C->getType())) - assert(CVTy->getNumElements() == + if (isa(C->getType())) + assert(cast(C->getType())->getNumElements() == cast(DstTy)->getNumElements() && "Invalid cast between a different 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(C->getType()) == isa(DstTy)); - if (auto *CVTy = dyn_cast(C->getType())) - assert(CVTy->getNumElements() == + if (isa(C->getType())) + assert(cast(C->getType())->getNumElements() == cast(DstTy)->getNumElements() && "Invalid cast between a different number of vector elements"); return getFoldedCast(Instruction::IntToPtr, C, DstTy, OnlyIfReduced);