[clang] [llvm] [IR] Change representation of getelementptr inrange (PR #84341)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 8 03:01:31 PST 2024
nikic wrote:
> And then want to restrict inrange to the inner array, then for the source-relative case we can write:
>
> ```
> %p1 = ptradd ptr %base, i32 %outer_idx * 44
> %p2 = ptradd ptr inrange(0, 40) %p1, i32 %inner_idx * 4
> ```
>
> While the result-relative case can't represent this without a dummy ptradd 0.
Hm no, the result-relative case can obviously also represent this, just need to move it to the first one:
```
%p1 = ptradd ptr inrange(0, 40) %base, i32 %outer_idx * 44
%p2 = ptradd ptr %p1, i32 %inner_idx * 4
```
In a sense this is more natural because the restriction is logically introduced by the first ptradd, not by the second one.
https://github.com/llvm/llvm-project/pull/84341
More information about the cfe-commits
mailing list