[PATCH] D22295: Introduce !splitpoint metadata and GlobalSplit pass.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 15:17:43 PDT 2016


pcc added inline comments.

================
Comment at: docs/LangRef.rst:4904
@@ +4903,3 @@
+will cross the boundary of a split point. The metadata allows the optimizer
+to split a global variable at split points if possible and beneficial.
+
----------------
hfinkel wrote:
> I find the specification of the semantics somewhat unclear. What I think this is trying to say is that the splitpoint metadata modifies the definition of 'inbounds' on GEPs, so that instead after:
> 
>   The in bounds addresses for an allocated object are all the addresses that point into the object, plus the address one byte past the end.
> 
> We add something like this:
> 
>   If the object is a global partitioned with one or more !splitpoint metadata, then in bounds addresses are all of the addresses that point into the same partition of the object as the base address. The address one byte past the end of the object is part of the last partition.
> 
> Maybe this is only true if the first GEP index value is a constant?
> 
> Alternatively, we might specify that the optimizer is free to add an arbitrary amount of padding at the split points. I'm not sure this is strong enough because the later partitions might actually end up with addresses before the first partition.
Is that enough, though? It would also be possible to calculate an offseted pointer with 2's complement arithmetic with a non-inbounds getelementptr, or with ptrtoint/add/inttoptr. In both of those cases, per the as-if rule, I'd expect those calculations to produce addresses within the global variable when crossing a split point without language to the contrary.

What I was thinking was that we provide a definition of "object" such that "splitpoint" metadata would allow a global variable to be represented using multiple objects.


http://reviews.llvm.org/D22295





More information about the llvm-commits mailing list