[llvm] r372743 - ConstantFold - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 05:30:14 PDT 2019
Author: rksimon
Date: Tue Sep 24 05:30:13 2019
New Revision: 372743
URL: http://llvm.org/viewvc/llvm-project?rev=372743&view=rev
Log:
ConstantFold - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Early out if the vector element is not Constant.
Modified:
llvm/trunk/lib/IR/ConstantFold.cpp
Modified: llvm/trunk/lib/IR/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantFold.cpp?rev=372743&r1=372742&r2=372743&view=diff
==============================================================================
--- llvm/trunk/lib/IR/ConstantFold.cpp (original)
+++ llvm/trunk/lib/IR/ConstantFold.cpp Tue Sep 24 05:30:13 2019
@@ -747,6 +747,7 @@ Constant *llvm::ConstantFoldSelectInstru
Constant *V2Element = ConstantExpr::getExtractElement(V2,
ConstantInt::get(Ty, i));
Constant *Cond = dyn_cast<Constant>(CondV->getOperand(i));
+ if (!Cond) break;
if (V1Element == V2Element) {
V = V1Element;
} else if (isa<UndefValue>(Cond)) {
More information about the llvm-commits
mailing list