<div dir="ltr">Because the condition comes from a Constant it must itself be a Constant? Could you change it to a cast<> then?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 1, 2019 at 1:31 AM Simon Pilgrim <<a href="mailto:llvm-dev@redking.me.uk">llvm-dev@redking.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>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 <span></span><span>ConstantVector</span></p>
<div>On 30/09/2019 21:35, David Blaikie
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Any test coverage for this codepath?</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Sep 24, 2019 at 5:28
AM Simon Pilgrim via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author:
rksimon<br>
Date: Tue Sep 24 05:30:13 2019<br>
New Revision: 372743<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=372743&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=372743&view=rev</a><br>
Log:<br>
ConstantFold - silence static analyzer dyn_cast<> null
dereference warning. NFCI.<br>
<br>
Early out if the vector element is not Constant.<br>
<br>
Modified:<br>
llvm/trunk/lib/IR/ConstantFold.cpp<br>
<br>
Modified: llvm/trunk/lib/IR/ConstantFold.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantFold.cpp?rev=372743&r1=372742&r2=372743&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantFold.cpp?rev=372743&r1=372742&r2=372743&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/ConstantFold.cpp (original)<br>
+++ llvm/trunk/lib/IR/ConstantFold.cpp Tue Sep 24 05:30:13
2019<br>
@@ -747,6 +747,7 @@ Constant *llvm::ConstantFoldSelectInstru<br>
Constant *V2Element =
ConstantExpr::getExtractElement(V2,<br>
ConstantInt::get(Ty, i));<br>
Constant *Cond =
dyn_cast<Constant>(CondV->getOperand(i));<br>
+ if (!Cond) break;<br>
if (V1Element == V2Element) {<br>
V = V1Element;<br>
} else if (isa<UndefValue>(Cond)) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote>
</div>
</blockquote>
</div>
</blockquote></div>