forked from OSchip/llvm-project
[clang] VisitCastExpr - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced, so assert the cast is correct (which it should be as we just created that ScalableVectorType) instead of returning nullptr
This commit is contained in:
parent
a5d6851489
commit
9ece72c159
|
@ -2093,7 +2093,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
|
|||
if (ScalableDst == PredType &&
|
||||
FixedSrc->getElementType() == Builder.getInt8Ty()) {
|
||||
DstTy = llvm::ScalableVectorType::get(Builder.getInt8Ty(), 2);
|
||||
ScalableDst = dyn_cast<llvm::ScalableVectorType>(DstTy);
|
||||
ScalableDst = cast<llvm::ScalableVectorType>(DstTy);
|
||||
NeedsBitCast = true;
|
||||
}
|
||||
if (FixedSrc->getElementType() == ScalableDst->getElementType()) {
|
||||
|
@ -2119,7 +2119,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
|
|||
if (ScalableSrc == PredType &&
|
||||
FixedDst->getElementType() == Builder.getInt8Ty()) {
|
||||
SrcTy = llvm::ScalableVectorType::get(Builder.getInt8Ty(), 2);
|
||||
ScalableSrc = dyn_cast<llvm::ScalableVectorType>(SrcTy);
|
||||
ScalableSrc = cast<llvm::ScalableVectorType>(SrcTy);
|
||||
Src = Builder.CreateBitCast(Src, SrcTy);
|
||||
}
|
||||
if (ScalableSrc->getElementType() == FixedDst->getElementType()) {
|
||||
|
|
Loading…
Reference in New Issue