[llvm] r372743 - ConstantFold - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 01:31:52 PDT 2019
TBH I think was being over cautious - we should be able to just use
cast<Constant> as we've already confirmed that CondV is a ConstantVector
On 30/09/2019 21:35, David Blaikie wrote:
> Any test coverage for this codepath?
>
> On Tue, Sep 24, 2019 at 5:28 AM Simon Pilgrim via llvm-commits
> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>
> 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)) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191001/ea89053b/attachment.html>
More information about the llvm-commits
mailing list