[llvm-dev] Opaque pointers and i8 GEPs

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 6 02:58:53 PDT 2021


On 04/09/2021 20:16, Arthur Eubanks wrote:
> Does this break the inrange specifier for GEPs 
> <https://llvm.org/docs/LangRef.html#getelementptr-instruction>? I don't 
> see how we'd be able to use inrange to specify that a GEP can only 
> access a certain element in an allocated object if we use i8 GEPs. 
> CC'ing Peter for more thoughts.
> 
> Initial inrange proposal: 
> https://lists.llvm.org/pipermail/llvm-dev/2016-July/102472.html 
> <https://lists.llvm.org/pipermail/llvm-dev/2016-July/102472.html>

For those not wanting to read the proposal, the idea is to provide a 
stricter version of inbounds where the bounds are within some sub-object.

I don't really like the way that this proposal is using LLVM type 
information, because LLVM type information is not something that we're 
able to make any strong guarantees about for in-memory types and so 
anything using LLVM types to define semantics is quite fragile.

I'd much rather see this expressed as a range.  You could express this 
with llvm.assume with a pair of integer comparisons, there's no need to 
tie it to the type info, though it may be desirable to provide a range 
as an attribute to avoid needing 5 instructions for the GEP.

David



More information about the llvm-dev mailing list