[clang] [llvm] [IR] Change representation of getelementptr inrange (PR #84341)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 09:01:13 PST 2024


nikic wrote:

@aeubanks @preames @nhaehnle Before I finish up this PR (need to update more tests and fix GlobalSplit), I'd like to have some feedback on one point.

I'm currently proposing the `inrange` attribute to be relative to the result pointer, so
```
getelementptr inbounds inrange(-16, 16) (i8, ptr @vt, i64 48)
```
would mean that `[-16, 16)` of the *result* is inrange, which would correspond to `[32, 64)` of the source.

An alternative would be to make inrange relative to the source pointer instead, in which case it would be:
```
getelementptr inbounds inrange(32, 64) (i8, ptr @vt, i64 48)
```

Does anyone have thoughts on which would be better?

I feel like I must have had a reason to pick this when writing the RFC, but I don't remember what it was... I'm starting to lean towards using the second form, because it will always give the same range regardless of which specific vtable pointer you point to.

https://github.com/llvm/llvm-project/pull/84341


More information about the cfe-commits mailing list