[llvm] r374243 - [InstCombine] Fix PR43617
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 16:07:58 PDT 2019
You could just use the CallInst version of getIntrinsicID() which already
does the right thing
~Craig
On Wed, Oct 9, 2019 at 3:01 PM Evandro Menezes via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: evandro
> Date: Wed Oct 9 15:03:23 2019
> New Revision: 374243
>
> URL: http://llvm.org/viewvc/llvm-project?rev=374243&view=rev
> Log:
> [InstCombine] Fix PR43617
>
> Check for `nullptr` before inspecting composite function.
>
> Modified:
> llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
>
> Modified: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=374243&r1=374242&r2=374243&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Wed Oct 9
> 15:03:23 2019
> @@ -1916,10 +1916,10 @@ Value *LibCallSimplifier::optimizeLog(Ca
> B.setFastMathFlags(FastMathFlags::getFast());
>
> Function *ArgFn = Arg->getCalledFunction();
> - StringRef ArgNm = ArgFn->getName();
> - Intrinsic::ID ArgID = ArgFn->getIntrinsicID();
> + Intrinsic::ID ArgID =
> + ArgFn ? ArgFn->getIntrinsicID() : Intrinsic::not_intrinsic;
> LibFunc ArgLb = NotLibFunc;
> - TLI->getLibFunc(ArgNm, ArgLb);
> + TLI->getLibFunc(Arg, ArgLb);
>
> // log(pow(x,y)) -> y*log(x)
> if (ArgLb == PowLb || ArgID == Intrinsic::pow) {
> @@ -1934,9 +1934,10 @@ Value *LibCallSimplifier::optimizeLog(Ca
> substituteInParent(Arg, MulY);
> return MulY;
> }
> +
> // log(exp{,2,10}(y)) -> y*log({e,2,10})
> // TODO: There is no exp10() intrinsic yet.
> - else if (ArgLb == ExpLb || ArgLb == Exp2Lb || ArgLb == Exp10Lb ||
> + if (ArgLb == ExpLb || ArgLb == Exp2Lb || ArgLb == Exp10Lb ||
> ArgID == Intrinsic::exp || ArgID == Intrinsic::exp2) {
> Constant *Eul;
> if (ArgLb == ExpLb || ArgID == Intrinsic::exp)
>
>
> _______________________________________________
> llvm-commits mailing list
> 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/20191009/997ef459/attachment.html>
More information about the llvm-commits
mailing list