[llvm] r372726 - SimplifyCFG - silence static analyzer dyn_cast<Instruction> null dereference warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 04:17:06 PDT 2019
Author: rksimon
Date: Tue Sep 24 04:17:06 2019
New Revision: 372726
URL: http://llvm.org/viewvc/llvm-project?rev=372726&view=rev
Log:
SimplifyCFG - silence static analyzer dyn_cast<Instruction> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<Instruction> directly and if not assert will fire for us.
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=372726&r1=372725&r2=372726&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Tue Sep 24 04:17:06 2019
@@ -632,8 +632,7 @@ private:
/// vector.
/// One "Extra" case is allowed to differ from the other.
void gather(Value *V) {
- Instruction *I = dyn_cast<Instruction>(V);
- bool isEQ = (I->getOpcode() == Instruction::Or);
+ bool isEQ = (cast<Instruction>(V)->getOpcode() == Instruction::Or);
// Keep a stack (SmallVector for efficiency) for depth-first traversal
SmallVector<Value *, 8> DFT;
More information about the llvm-commits
mailing list