Commit 708742f
authored
Rollup merge of rust-lang#144192 - RalfJung:atomicrmw-ptr, r=nikic
atomicrmw on pointers: move integer-pointer cast hacks into backend
Conceptually, we want to have atomic operations on pointers of the form `fn atomic_add(ptr: *mut T, offset: usize, ...)`. However, LLVM does not directly support such operations (llvm/llvm-project#120837), so we have to cast the `offset` to a pointer somewhere.
This PR moves that hack into the LLVM backend, so that the standard library, intrinsic, and Miri all work with the conceptual operation we actually want. Hopefully, one day LLVM will gain a way to represent these operations without integer-pointer casts, and then the hack will disappear entirely.
Cc ```@nikic``` -- this is the best we can do right now, right?
Fixes rust-lang#1346171 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1671 | 1671 | | |
1672 | 1672 | | |
1673 | 1673 | | |
| 1674 | + | |
1674 | 1675 | | |
1675 | 1676 | | |
1676 | 1677 | | |
| |||
1698 | 1699 | | |
1699 | 1700 | | |
1700 | 1701 | | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
1701 | 1705 | | |
1702 | 1706 | | |
1703 | 1707 | | |
1704 | 1708 | | |
1705 | 1709 | | |
1706 | 1710 | | |
1707 | 1711 | | |
1708 | | - | |
| 1712 | + | |
| 1713 | + | |
1709 | 1714 | | |
1710 | 1715 | | |
1711 | 1716 | | |
| |||
0 commit comments