Skip to content

Commit

Permalink
Verifier - silence static analyzer dyn_cast<VectorType> null derefere…
Browse files Browse the repository at this point in the history
…nce warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use cast<VectorType> directly and if not assert will fire for us.

llvm-svn: 372529
  • Loading branch information
RKSimon committed Sep 22, 2019
1 parent 557cee3 commit 638933a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2722,8 +2722,8 @@ void Verifier::visitPtrToIntInst(PtrToIntInst &I) {
&I);

if (SrcTy->isVectorTy()) {
VectorType *VSrc = dyn_cast<VectorType>(SrcTy);
VectorType *VDest = dyn_cast<VectorType>(DestTy);
VectorType *VSrc = cast<VectorType>(SrcTy);
VectorType *VDest = cast<VectorType>(DestTy);
Assert(VSrc->getNumElements() == VDest->getNumElements(),
"PtrToInt Vector width mismatch", &I);
}
Expand All @@ -2747,8 +2747,8 @@ void Verifier::visitIntToPtrInst(IntToPtrInst &I) {
Assert(SrcTy->isVectorTy() == DestTy->isVectorTy(), "IntToPtr type mismatch",
&I);
if (SrcTy->isVectorTy()) {
VectorType *VSrc = dyn_cast<VectorType>(SrcTy);
VectorType *VDest = dyn_cast<VectorType>(DestTy);
VectorType *VSrc = cast<VectorType>(SrcTy);
VectorType *VDest = cast<VectorType>(DestTy);
Assert(VSrc->getNumElements() == VDest->getNumElements(),
"IntToPtr Vector width mismatch", &I);
}
Expand Down

0 comments on commit 638933a

Please sign in to comment.