<div dir="ltr">You could just use the CallInst version of getIntrinsicID() which already does the right thing<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2019 at 3:01 PM Evandro Menezes via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">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: evandro<br>
Date: Wed Oct 9 15:03:23 2019<br>
New Revision: 374243<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=374243&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=374243&view=rev</a><br>
Log:<br>
[InstCombine] Fix PR43617<br>
<br>
Check for `nullptr` before inspecting composite function.<br>
<br>
Modified:<br>
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp<br>
<br>
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=374243&r1=374242&r2=374243&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=374243&r1=374242&r2=374243&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Wed Oct 9 15:03:23 2019<br>
@@ -1916,10 +1916,10 @@ Value *LibCallSimplifier::optimizeLog(Ca<br>
B.setFastMathFlags(FastMathFlags::getFast());<br>
<br>
Function *ArgFn = Arg->getCalledFunction();<br>
- StringRef ArgNm = ArgFn->getName();<br>
- Intrinsic::ID ArgID = ArgFn->getIntrinsicID();<br>
+ Intrinsic::ID ArgID =<br>
+ ArgFn ? ArgFn->getIntrinsicID() : Intrinsic::not_intrinsic;<br>
LibFunc ArgLb = NotLibFunc;<br>
- TLI->getLibFunc(ArgNm, ArgLb);<br>
+ TLI->getLibFunc(Arg, ArgLb);<br>
<br>
// log(pow(x,y)) -> y*log(x)<br>
if (ArgLb == PowLb || ArgID == Intrinsic::pow) {<br>
@@ -1934,9 +1934,10 @@ Value *LibCallSimplifier::optimizeLog(Ca<br>
substituteInParent(Arg, MulY);<br>
return MulY;<br>
}<br>
+<br>
// log(exp{,2,10}(y)) -> y*log({e,2,10})<br>
// TODO: There is no exp10() intrinsic yet.<br>
- else if (ArgLb == ExpLb || ArgLb == Exp2Lb || ArgLb == Exp10Lb ||<br>
+ if (ArgLb == ExpLb || ArgLb == Exp2Lb || ArgLb == Exp10Lb ||<br>
ArgID == Intrinsic::exp || ArgID == Intrinsic::exp2) {<br>
Constant *Eul;<br>
if (ArgLb == ExpLb || ArgID == Intrinsic::exp)<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>