From dd9382651fee69e49da3a90b35c1f65f62124401 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 28 Dec 2024 21:33:21 -0600 Subject: [PATCH] Added a codegen test for combining `RangeToInclusive` with other optimizations Closes #63646 --- tests/codegen/range-to-inclusive.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/codegen/range-to-inclusive.rs diff --git a/tests/codegen/range-to-inclusive.rs b/tests/codegen/range-to-inclusive.rs new file mode 100644 index 0000000000000..5cfda9627918f --- /dev/null +++ b/tests/codegen/range-to-inclusive.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @and_stuff +#[no_mangle] +pub fn and_stuff(a: i32, mut b: i32) -> i32 { + // CHECK: start: + // CHECK-NEXT: and + // CHECK-NEXT: ret + for _ in 0..=64 { + b &= a; + } + + b +}