<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" 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 class="o"></span><span class="n">ConstantVector</span></p>
<div class="moz-cite-prefix">On 30/09/2019 21:35, David Blaikie
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAENS6EsSs5bcFrf7tw1Hqej63iJO3Xu1-n19HCw4Qg6xSnNViw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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"
moz-do-not-send="true">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" moz-do-not-send="true">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" moz-do-not-send="true">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"
moz-do-not-send="true">llvm-commits@lists.llvm.org</a><br>
<a
href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote>
</div>
</blockquote>
</body>
</html>