Skip to content

Commit f991a16

Browse files
committed
[CodeGen] ExpandLargeFpConvert - don't dereference a dyn_cast result
dyn_cast is allowed to return NULL - use cast<> to assert that the cast type is valid Fixes static analysis warning.
1 parent 3f9e2e1 commit f991a16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/CodeGen/ExpandLargeFpConvert.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static bool runImpl(Function &F, const TargetLowering &TLI) {
611611
if (I.getOperand(0)->getType()->isScalableTy())
612612
continue;
613613

614-
auto *IntTy = dyn_cast<IntegerType>(I.getType()->getScalarType());
614+
auto *IntTy = cast<IntegerType>(I.getType()->getScalarType());
615615
if (IntTy->getIntegerBitWidth() <= MaxLegalFpConvertBitWidth)
616616
continue;
617617

@@ -629,7 +629,7 @@ static bool runImpl(Function &F, const TargetLowering &TLI) {
629629
continue;
630630

631631
auto *IntTy =
632-
dyn_cast<IntegerType>(I.getOperand(0)->getType()->getScalarType());
632+
cast<IntegerType>(I.getOperand(0)->getType()->getScalarType());
633633
if (IntTy->getIntegerBitWidth() <= MaxLegalFpConvertBitWidth)
634634
continue;
635635

0 commit comments

Comments
 (0)