about summary refs log tree commit diff
path: root/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-08-22 22:00:50 -0400
committerGitHub <noreply@github.com>2025-08-22 22:00:50 -0400
commitf0a414870a0aa295c0d35e0d980f99d5b892f72b (patch)
tree3d2ffb464e53aff3fe1d8352b779b2a3522763d0 /tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs
parent5cfdbd6c08681249cab4794366d2ade92e1f7c03 (diff)
parent9e28de2720e658b015e4609001bad7b11eac1e6d (diff)
downloadrust-f0a414870a0aa295c0d35e0d980f99d5b892f72b.tar.gz
rust-f0a414870a0aa295c0d35e0d980f99d5b892f72b.zip
Rollup merge of #145380 - okaneco:add-codegen-tests, r=Mark-Simulacrum
Add codegen-llvm regression tests

Most of these regressions deal with elimination of panics and bounds checks that were fixed upstream by LLVM.

closes https://github.com/rust-lang/rust/issues/141497
closes https://github.com/rust-lang/rust/issues/131162
closes https://github.com/rust-lang/rust/issues/129583
closes https://github.com/rust-lang/rust/issues/110971
closes https://github.com/rust-lang/rust/issues/91109
closes https://github.com/rust-lang/rust/issues/80075
closes https://github.com/rust-lang/rust/issues/74917
closes https://github.com/rust-lang/rust/issues/71997
closes https://github.com/rust-lang/rust/issues/71257
closes https://github.com/rust-lang/rust/issues/59352
Diffstat (limited to 'tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs')
-rw-r--r--tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs b/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs
new file mode 100644
index 00000000000..bffbcd7d069
--- /dev/null
+++ b/tests/codegen-llvm/issues/for-loop-inner-assert-91109.rs
@@ -0,0 +1,18 @@
+// Tests that there's no bounds check for the inner loop after the assert.
+
+//@ compile-flags: -Copt-level=3
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: @zero
+#[no_mangle]
+pub fn zero(d: &mut [Vec<i32>]) {
+    // CHECK-NOT: panic_bounds_check
+    let n = d.len();
+    for i in 0..n {
+        assert!(d[i].len() == n);
+        for j in 0..n {
+            d[i][j] = 0;
+        }
+    }
+}