bors
5dcb678ad8
Auto merge of #122917 - saethlin:atomicptr-to-int, r=nikic
...
Add the missing inttoptr when we ptrtoint in ptr atomics
Ralf noticed this here: https://github.com/rust-lang/rust/pull/122220#discussion_r1535172094
Our previous codegen forgot to add the cast back to integer type. The code compiles anyway, because of course all locals are in-memory to start with, so previous codegen would do the integer atomic, store the integer to a local, then load a pointer from that local. Which is definitely _not_ what we wanted: That's an integer-to-pointer transmute, so all pointers returned by these `AtomicPtr` methods didn't have provenance. Yikes.
Here's the IR for `AtomicPtr::fetch_byte_add` on 1.76: https://godbolt.org/z/8qTEjeraY
```llvm
define noundef ptr `@atomicptr_fetch_byte_add(ptr` noundef nonnull align 8 %a, i64 noundef %v) unnamed_addr #0 !dbg !7 {
start:
%0 = alloca ptr, align 8, !dbg !12
%val = inttoptr i64 %v to ptr, !dbg !12
call void `@llvm.lifetime.start.p0(i64` 8, ptr %0), !dbg !28
%1 = ptrtoint ptr %val to i64, !dbg !28
%2 = atomicrmw add ptr %a, i64 %1 monotonic, align 8, !dbg !28
store i64 %2, ptr %0, align 8, !dbg !28
%self = load ptr, ptr %0, align 8, !dbg !28
call void `@llvm.lifetime.end.p0(i64` 8, ptr %0), !dbg !28
ret ptr %self, !dbg !33
}
```
r? `@RalfJung`
cc `@nikic`
2024-04-15 08:07:47 +00:00
..
2024-02-22 16:04:04 +00:00
2024-04-12 17:41:33 +02:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-08 19:20:04 +08:00
2024-04-10 13:50:27 -04:00
2024-02-23 11:29:01 +11:00
2024-02-22 16:04:04 +00:00
2024-04-02 19:21:44 +00:00
2024-04-10 08:28:43 -07:00
2024-02-23 18:04:01 -05:00
2024-03-10 16:04:12 -04:00
2024-02-22 16:04:04 +00:00
2024-02-23 11:28:06 +11:00
2024-04-12 15:29:39 +03:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-10 16:04:12 -04:00
2024-02-22 16:04:04 +00:00
2024-04-06 08:56:35 +02:00
2024-03-28 21:28:45 +08:00
2024-02-25 08:15:44 +01:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:38:54 -04:00
2024-03-05 18:54:45 -05:00
2024-03-05 18:54:45 -05:00
2024-03-05 18:54:45 -05:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-03-05 18:54:45 -05:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-09 08:51:32 -07:00
2024-02-25 12:03:48 +01:00
2024-02-23 18:04:01 -05:00
2024-04-09 08:51:32 -07:00
2024-04-11 17:20:08 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-24 19:49:16 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-23 00:07:02 -04:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-17 13:40:27 -04:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-13 01:17:15 -04:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-23 10:52:55 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-26 18:12:07 +01:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-14 14:10:45 +00:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-03-10 22:47:30 -04:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-05 18:54:45 -05:00
2024-03-11 04:45:27 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-26 22:28:09 -05:00
2024-02-23 18:04:01 -05:00
2024-03-22 09:55:50 -04:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-25 18:32:45 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-03-11 09:36:35 -07:00
2024-04-08 19:00:53 +08:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-05 18:54:45 -05:00
2024-04-09 08:51:32 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-17 10:11:04 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-04 21:59:08 +01:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-17 10:52:00 -07:00
2024-03-19 16:32:01 +00:00
2024-03-25 18:32:45 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-08 12:02:19 +00:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-08 11:15:36 +09:00
2024-03-12 19:01:04 -04:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-09 05:25:51 +02:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-12 19:01:04 -04:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-04-06 14:09:03 -04:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-02-25 12:03:48 +01:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-29 17:08:36 +01:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-06 11:37:57 -07:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-03-17 11:59:18 -07:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-17 10:11:04 -07:00
2024-02-25 12:03:48 +01:00
2024-03-11 18:19:17 -04:00
2024-02-22 16:04:04 +00:00
2024-02-27 00:09:12 -05:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-04-06 11:21:47 -04:00
2024-04-11 17:20:08 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-03-29 15:37:43 -07:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-03-17 10:11:04 -07:00
2024-03-01 18:24:02 +00:00
2024-02-23 18:04:01 -05:00
2024-04-08 12:12:13 +02:00
2024-02-23 18:04:01 -05:00
2024-02-23 18:04:01 -05:00
2024-02-22 16:04:04 +00:00
2024-02-23 18:04:01 -05:00
2024-03-10 22:47:30 -04:00
2024-02-22 16:04:04 +00:00
2024-03-11 09:36:35 -07:00
2024-02-22 16:04:04 +00:00
2024-03-04 09:32:33 -05:00