[PATCH] Moving MipsOptimizeMathLibCalls to Transforms/Scalar

Eric Christopher echristo at gmail.com
Thu Aug 22 13:22:31 PDT 2013


LGTM.

-eric

On Thu, Aug 22, 2013 at 8:51 AM, Richard Sandiford
<rsandifo at linux.vnet.ibm.com> wrote:
> [started out as a thread on llvm-dev]
>
> Akira Hatanaka <ahatanak at gmail.com> writes:
>> Assuming it is okay to make this pass generic, I would consider running it
>> as the last IR pass (at the end of TargetPassConfig::addIRPasses).
>
> Yeah, I suppose we should make it opt-in for now, since it can only handle
> sqrt at the moment.  I went for the more general name PartiallyInlineLibCalls
> Just In Case though.  This optimisation seems to fit into the same
> category as checking the first pair of bytes before caling strcmp, etc.
>
> How does this look?  As you can see, most of it is lifted verbatim
> from the MIPS version.  The only real difference is that we now use
> TargetTransformInfo to check whether a sqrt instruction is available.
> That should cope with the soft-float cases (including MIPS16).
>
> For context, the original message was:
>
>>> Richard Sandiford <rsandifo at linux.vnet.ibm.com> writes:
>>> > MipsOptimizeMathLibCalls.cpp converts:
>>> >
>>> >   g = sqrt (f);
>>> >
>>> > into:
>>> >
>>> >   r1 = sqrt (f) readonly;
>>> >   if (g is a NaN)
>>> >     r2 = sqrt (f);
>>> >   g = phi (r1, r2)
>>> >
>>> > I'd like to do the same on z.  Would it be OK to make this pass generic
>>> > and do the transformation whenever FSQRT isLegalOrCustom for the type?
>>> >
>>> > If so, should it stay a separate pass, or should I merge it with
>>> > something else?
>
> Thanks,
> Richard
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list