mirror of
https://github.com/Noratrieb/blog.git
synced 2026-01-14 12:35:00 +01:00
another noalias fix
This commit is contained in:
parent
0058bac352
commit
90e1764189
1 changed files with 1 additions and 1 deletions
|
|
@ -87,7 +87,7 @@ define void @takes_box_and_ptr_to_it(i8* noalias %0, i8* %ptr) {
|
||||||
|
|
||||||
See the little attribute on the first parameter called `noalias`? That's what's doing the magic here.
|
See the little attribute on the first parameter called `noalias`? That's what's doing the magic here.
|
||||||
`noalias` is an LLVM attribute on pointers that allows for various optimizations. If there are two pointers,
|
`noalias` is an LLVM attribute on pointers that allows for various optimizations. If there are two pointers,
|
||||||
and at least one of them is `noalias`, there are some restrictions around the two:
|
and at least one of them is `noalias`, there are some restrictions around the two. Approximately:
|
||||||
- If one of them writes, they must not point to the same value (alias each other)
|
- If one of them writes, they must not point to the same value (alias each other)
|
||||||
- If neither of them writes, they can alias just fine.
|
- If neither of them writes, they can alias just fine.
|
||||||
Therefore, we also apply `noalias` to `&mut T` and `&T` (if it doesn't contain interior mutability through
|
Therefore, we also apply `noalias` to `&mut T` and `&T` (if it doesn't contain interior mutability through
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue