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

Chandler Carruth chandlerc at google.com
Wed Mar 14 01:43:16 PDT 2012


On Tue, Mar 13, 2012 at 1:23 AM, Duncan Sands <baldrick at free.fr> wrote:

> maybe I'm missing something, but are all compares really guaranteed to
> produce a
> constant result here?
>

We check below that the LHS and RHS are the "related" pointers. The idea is
that the LHS is derived from the RHS (or vice versa) via constant
operations. Thus the comparison of them will produce some constant.

Think of it this way, all comparison outcomes can be determined by
inspecting some aspect of the result of a subtraction. In the same way that
the subtraction removes the non-constant base pointer leaving only the
constant relationship, the comparison will as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120314/562e8d4f/attachment.html>


More information about the llvm-commits mailing list