From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/codegen/issues/issue-75546.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/codegen/issues/issue-75546.rs (limited to 'tests/codegen/issues/issue-75546.rs') diff --git a/tests/codegen/issues/issue-75546.rs b/tests/codegen/issues/issue-75546.rs new file mode 100644 index 000000000..470a9e040 --- /dev/null +++ b/tests/codegen/issues/issue-75546.rs @@ -0,0 +1,15 @@ +// compile-flags: -O +#![crate_type = "lib"] + +// Test that LLVM can eliminate the impossible `i == 0` check. + +// CHECK-LABEL: @issue_75546 +#[no_mangle] +pub fn issue_75546() { + let mut i = 1u32; + while i < u32::MAX { + // CHECK-NOT: panic + if i == 0 { panic!(); } + i += 1; + } +} -- cgit v1.2.3