[llvm] r372732 - LoopVectorize - silence static analyzer dyn_cast<CmpInst> null dereference warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 04:27:38 PDT 2019


Author: rksimon
Date: Tue Sep 24 04:27:38 2019
New Revision: 372732

URL: http://llvm.org/viewvc/llvm-project?rev=372732&view=rev
Log:
LoopVectorize - silence static analyzer dyn_cast<CmpInst> null dereference warning. NFCI.

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

Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=372732&r1=372731&r2=372732&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Tue Sep 24 04:27:38 2019
@@ -4178,7 +4178,7 @@ void InnerLoopVectorizer::widenInstructi
   case Instruction::FCmp: {
     // Widen compares. Generate vector compares.
     bool FCmp = (I.getOpcode() == Instruction::FCmp);
-    auto *Cmp = dyn_cast<CmpInst>(&I);
+    auto *Cmp = cast<CmpInst>(&I);
     setDebugLocFromInst(Builder, Cmp);
     for (unsigned Part = 0; Part < UF; ++Part) {
       Value *A = getOrCreateVectorValue(Cmp->getOperand(0), Part);




More information about the llvm-commits mailing list