]> granicus.if.org Git - llvm/commitdiff
[LoopVectorize] Don't dereference a dyn_cast result. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 17 Sep 2019 13:24:54 +0000 (13:24 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 17 Sep 2019 13:24:54 +0000 (13:24 +0000)
The static analyzer is warning about potential null dereferences of dyn_cast<> results, we can use cast<> directly as we know that these cases should all be CastInst, which is why its working atm and anyway cast<> will assert if they aren't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372116 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp

index 549a24cbdc3a7160be01efa9791fe19589dc37e7..9f583cacce25f9e786fe0eebee69c4f0538633eb 100644 (file)
@@ -4200,7 +4200,7 @@ void InnerLoopVectorizer::widenInstruction(Instruction &I) {
   case Instruction::Trunc:
   case Instruction::FPTrunc:
   case Instruction::BitCast: {
-    auto *CI = dyn_cast<CastInst>(&I);
+    auto *CI = cast<CastInst>(&I);
     setDebugLocFromInst(Builder, CI);
 
     /// Vectorize casts.