We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f3cc59b + ddd8878 commit 7a4904cCopy full SHA for 7a4904c
tests/codegen/issues/issue-115385-llvm-jump-threading.rs
@@ -0,0 +1,46 @@
1
+// compile-flags: -O -Ccodegen-units=1
2
+
3
+#![crate_type = "lib"]
4
5
+#[repr(i64)]
6
+pub enum Boolean {
7
+ False = 0,
8
+ True = 1,
9
+}
10
11
+impl Clone for Boolean {
12
+ fn clone(&self) -> Self {
13
+ *self
14
+ }
15
16
17
+impl Copy for Boolean {}
18
19
+extern "C" {
20
+ fn set_value(foo: *mut i64);
21
+ fn bar();
22
23
24
+pub fn foo(x: bool) {
25
+ let mut foo = core::mem::MaybeUninit::<i64>::uninit();
26
+ unsafe {
27
+ set_value(foo.as_mut_ptr());
28
29
30
+ if x {
31
+ let l1 = unsafe { *foo.as_mut_ptr().cast::<Boolean>() };
32
+ if matches!(l1, Boolean::False) {
33
34
+ *foo.as_mut_ptr() = 0;
35
36
37
38
39
+ let l2 = unsafe { *foo.as_mut_ptr() };
40
+ if l2 == 2 {
41
+ // CHECK: call void @bar
42
43
+ bar();
44
45
46
0 commit comments