Skip to content

Commit 9160b79

Browse files
jamie-osecclubby789
authored andcommitted
Add codegen test for issue 138497
1 parent 2c1ac85 commit 9160b79

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! This test checks that removing trailing zeroes from a `NonZero`,
2+
//! then creating a new `NonZero` from the result does not panic.
3+
4+
//@ min-llvm-version: 21
5+
//@ compile-flags: -O -Zmerge-functions=disabled
6+
#![crate_type = "lib"]
7+
8+
use std::num::NonZero;
9+
10+
// CHECK-LABEL: @remove_trailing_zeros
11+
#[no_mangle]
12+
pub fn remove_trailing_zeros(x: NonZero<u8>) -> NonZero<u8> {
13+
// CHECK-NOT: unwrap_failed
14+
// CHECK-NOT: br
15+
// CHECK ret i8
16+
NonZero::new(x.get() >> x.trailing_zeros()).unwrap()
17+
}

0 commit comments

Comments
 (0)