Skip to content

Commit 66653dc

Browse files
committed
Update codegen tests
1 parent a89894d commit 66653dc

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

tests/codegen/constant-branch.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ pub fn if_constant_match() {
4141
_ => 4,
4242
};
4343

44-
// CHECK: br label %[[MINUS1:.+]]
44+
// CHECK: br label %{{.+}}
4545
_ = match -1 {
46-
// CHECK: [[MINUS1]]:
47-
// CHECK: store i32 1
4846
-1 => 1,
4947
_ => 0,
5048
}
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//@ compile-flags: -Cno-prepopulate-passes -Copt-level=0
2+
3+
#![crate_type = "lib"]
4+
5+
#[inline(never)]
6+
fn test<const SIZE: usize>() {
7+
// CHECK-LABEL: no_alloca_inside_if_false::test
8+
// CHECK: start:
9+
// CHECK-NEXT: %0 = alloca
10+
// CHECK-NEXT: %vec = alloca
11+
// CHECK-NOT: %arr = alloca
12+
if const { SIZE < 4096 } {
13+
let arr = [0u8; SIZE];
14+
std::hint::black_box(&arr);
15+
} else {
16+
let vec = vec![0u8; SIZE];
17+
std::hint::black_box(&vec);
18+
}
19+
}
20+
21+
pub fn main() {
22+
test::<8192>();
23+
}

0 commit comments

Comments
 (0)