Skip to content

Commit 3fc22e4

Browse files
authored
Merge pull request #570 from RalfJung/llvm
add list of assumptions we make about LLVM
2 parents c138499 + 36e023a commit 3fc22e4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

resources/llvm-assumptions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Some of the things we want people to do with Rust can currently not be expressed in LLVM in a way that is fully backed by the LLVM LangRef.
2+
Let's collect a list of those cases here.
3+
4+
## List of LLVM assumptions not backed by the spec
5+
6+
- To implement `ptr.addr()`, we assume that a pointer-to-int transmute yields the address.
7+
The LangRef is quiet about this (as it is about almost everything related to provenance).
8+
Alive says that this yields poison.
9+
- To implement the desired semantics for `MaybeUninit<$int>` we need a type of arbitrary size that can hold arbitrary data -- including provenance.
10+
LLVM currently has no such type, the only type that is fully guaranteed to support provenance is `ptr` and that has a fixed size.
11+
- This one is not about current Rust but about possible future extensions:
12+
when LLVM returns `poison` for some operation, we can *not* say that this corresponds to `uninit` in Rust. We *must* declare this immediate UB.
13+
The reason for this is that LLVM does not really support `poison` being stored in memory; Rust's `uninit` can therefore only correspond to LLVM's `undef`.

0 commit comments

Comments
 (0)