[llvm-commits] PATCH: Add support for tracking pairs of pointers with a constant offset to inline cost estimation

Chandler Carruth chandlerc at gmail.com
Sun Mar 11 16:45:44 PDT 2012


Patch attached which addresses most of your comments, and also is much
cleaner. Lots of small inefficiencies are removed, etc. It also uses the
common routines that you suggested adding to LLVM and now are in the core
Value api.

There is one issue which, after discussion on IRC, I think we both agreed
wasn't an actual problem:

On Thu, Mar 8, 2012 at 10:41 PM, Nick Lewycky <nicholas at mxc.ca> wrote:

> +      if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) {
> +        // If the GEP has variable indices, we won't be able to do much
> with it.
> +        if (!GEP->hasAllConstantIndices())
> +          continue;
>
> inbounds should be sufficient as well.
>
> Also, this function should handle SelectInst. Something like:
>

Chatted about this and i clarified why we actually need constant indices.
The goal is to detect comparisons and subtracts which produce actual
constants after inlining, and that prevents looking through inbounds GEPs
or selects. We could get extra clever w/ select and a few other
instructions, but it doesn't seem terribly important.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120311/030ac59a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inline-cost-ptr-pair.diff
Type: application/octet-stream
Size: 6543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120311/030ac59a/attachment.obj>


More information about the llvm-commits mailing list