Skip to content

Commit 19ec3e2

Browse files
committed
Auto merge of rust-lang#136761 - workingjubilee:specify-opt-level-for-codegen-tests, r=<try>
tests: `-Copt-level=3` instead of `-O` in codegen tests An effective blocker for rust-lang#135439 r? `@ghost` try-job: test-various try-job: aarch64-gnu try-job: aarch64-gnu-debug try-job: i686-gnu-1 try-job: i686-gnu-2 try-job: i686-mingw try-job: i686-msvc-1 try-job: i686-msvc-2 try-job: x86_64-msvc-1 try-job: x86_64-msvc-2
2 parents 43ca9d1 + bba98a6 commit 19ec3e2

File tree

235 files changed

+269
-291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+269
-291
lines changed

tests/codegen/abi-repr-ext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
//@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv
44

tests/codegen/align-offset.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/alloc-optimisation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
#![crate_type = "lib"]
33

44
#[no_mangle]

tests/codegen/array-clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/array-codegen.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -C no-prepopulate-passes
1+
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
22

33
#![crate_type = "lib"]
44

tests/codegen/array-equality.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Z merge-functions=disabled
1+
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
22
//@ only-x86_64
33
#![crate_type = "lib"]
44

tests/codegen/array-optimized.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/array-repeat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44
#![feature(array_repeat)]

tests/codegen/asm/goto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]

tests/codegen/asm/may_unwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]

tests/codegen/asm/maybe-uninit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]

tests/codegen/asm/multiple-options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]

tests/codegen/asm/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]

tests/codegen/asm/x86-clobber_abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]

tests/codegen/asm/x86-clobbers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ only-x86_64
33

44
#![crate_type = "rlib"]

tests/codegen/atomic-operations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Code generation of atomic operations.
2-
//@ compile-flags: -O
2+
//@ compile-flags: -Copt-level=3
33
#![crate_type = "lib"]
44

55
use std::sync::atomic::AtomicI32;

tests/codegen/atomicptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// ensures that we do not have such a round-trip for AtomicPtr::swap, because LLVM supports pointer
55
// arguments to `atomicrmw xchg`.
66

7-
//@ compile-flags: -O -Cno-prepopulate-passes
7+
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes
88
#![crate_type = "lib"]
99
#![feature(strict_provenance_atomic_ptr)]
1010

tests/codegen/avr/avr-func-addrspace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O --target=avr-unknown-gnu-atmega328 --crate-type=rlib -C panic=abort
1+
//@ compile-flags: -Copt-level=3 --target=avr-unknown-gnu-atmega328 --crate-type=rlib -C panic=abort
22
//@ needs-llvm-components: avr
33

44
// This test validates that function pointers can be stored in global variables

tests/codegen/binary-heap-peek-mut-pop-no-panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ ignore-std-debug-assertions
33
#![crate_type = "lib"]
44

tests/codegen/binary-search-index-no-bound-check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
#![crate_type = "lib"]
33

44
// Make sure no bounds checks are emitted when slicing or indexing

tests/codegen/box-uninit-bytes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
#![crate_type = "lib"]
33

44
use std::mem::MaybeUninit;

tests/codegen/call-metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Checks that range metadata gets emitted on calls to functions returning a
22
// scalar value.
33

4-
//@ compile-flags: -O -C no-prepopulate-passes
4+
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
55
//@ max-llvm-major-version: 18
66

77
#![crate_type = "lib"]

tests/codegen/cast-optimized.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Z merge-functions=disabled
1+
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
22
#![crate_type = "lib"]
33

44
// This tests that LLVM can optimize based on the niches in the source or

tests/codegen/cast-target-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ignore-tidy-linelength
22
//@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64
33
//@ min-llvm-version: 19
4-
//@ compile-flags: -O -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
4+
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
55

66
//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
77
//@[aarch64] needs-llvm-components: arm

tests/codegen/catch-unwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
// On x86 the closure is inlined in foo() producing something like
44
// define i32 @foo() [...] {

tests/codegen/char-ascii-branchless.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Checks that these functions are branchless.
22
//
3-
//@ compile-flags: -O
3+
//@ compile-flags: -Copt-level=3
44

55
#![crate_type = "lib"]
66

tests/codegen/checked_ilog.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/checked_math.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Z merge-functions=disabled
1+
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
22

33
#![crate_type = "lib"]
44
#![feature(unchecked_shifts)]

tests/codegen/clone_as_copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ revisions: DEBUGINFO NODEBUGINFO
22
//@ compile-flags: -Zunsound-mir-opts
33
// FIXME: see <https://github.com/rust-lang/rust/issues/132353>
4-
//@ compile-flags: -O -Cno-prepopulate-passes
4+
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes
55
//@ [DEBUGINFO] compile-flags: -Cdebuginfo=full
66

77
// From https://github.com/rust-lang/rust/issues/128081.

tests/codegen/common_prim_int_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44
#![feature(core_intrinsics)]

tests/codegen/const-array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/cross-crate-inlining/always-inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ aux-build:always.rs
33

44
#![crate_type = "lib"]

tests/codegen/cross-crate-inlining/auxiliary/always.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Zcross-crate-inline-threshold=always
1+
//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=always
22

33
#![crate_type = "lib"]
44

tests/codegen/cross-crate-inlining/auxiliary/leaf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/cross-crate-inlining/auxiliary/never.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Zcross-crate-inline-threshold=never
1+
//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=never
22

33
#![crate_type = "lib"]
44

tests/codegen/cross-crate-inlining/leaf-inlining.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Zcross-crate-inline-threshold=yes
1+
//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=yes
22
//@ aux-build:leaf.rs
33

44
#![crate_type = "lib"]

tests/codegen/cross-crate-inlining/never-inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22
//@ aux-build:never.rs
33

44
#![crate_type = "lib"]

tests/codegen/dealloc-no-unwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/debug-fndef-size.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Verify that `i32::cmp` FnDef type is declared with a size of 0 and an
22
// alignment of 8 bits (1 byte) in LLVM debuginfo.
33

4-
//@ compile-flags: -O -g -Cno-prepopulate-passes
4+
//@ compile-flags: -Copt-level=3 -g -Cno-prepopulate-passes
55
//@ ignore-msvc the types are mangled differently
66

77
use std::cmp::Ordering;

tests/codegen/debuginfo-constant-locals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -g -O
1+
//@ compile-flags: -g -Copt-level=3
22

33
// Check that simple constant values are preserved in debuginfo across both MIR opts and LLVM opts
44

tests/codegen/debuginfo-inline-callsite-location.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -g -O -C panic=abort
1+
//@ compile-flags: -g -Copt-level=3 -C panic=abort
22

33
// Check that each inline call site for the same function uses the same "sub-program" so that LLVM
44
// can correctly merge the debug info if it merges the inlined code (e.g., for merging of tail

tests/codegen/deduced-param-attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44
#![allow(incomplete_features)]
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//@ revisions: OPT2 OPT3
2+
//@ [OPT2] compile-flags: -Copt-level=2
3+
//@ [OPT3] compile-flags: -C opt-level=3
4+
//@ min-llvm-version: 18.1.3
5+
6+
#![crate_type = "lib"]
7+
#![no_std]
8+
9+
// The code is from https://github.com/rust-lang/rust/issues/122805.
10+
// Ensure we do not generate the shufflevector instruction
11+
// to avoid complicating the code.
12+
// CHECK-LABEL: define{{.*}}void @convert(
13+
// CHECK-NOT: shufflevector
14+
// On higher opt levels, this should just be a bswap:
15+
// OPT3: store <8 x i16>
16+
// OPT3-NEXT: call <8 x i16> @llvm.bswap
17+
// OPT3-NEXT: store <8 x i16>
18+
// OPT3-NEXT: ret void
19+
#[no_mangle]
20+
pub fn convert(value: [u16; 8]) -> [u8; 16] {
21+
#[cfg(target_endian = "little")]
22+
let bswap = u16::to_be;
23+
#[cfg(target_endian = "big")]
24+
let bswap = u16::to_le;
25+
let addr16 = [
26+
bswap(value[0]),
27+
bswap(value[1]),
28+
bswap(value[2]),
29+
bswap(value[3]),
30+
bswap(value[4]),
31+
bswap(value[5]),
32+
bswap(value[6]),
33+
bswap(value[7]),
34+
];
35+
unsafe { core::mem::transmute::<_, [u8; 16]>(addr16) }
36+
}

tests/codegen/drop-in-place-noalias.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -C no-prepopulate-passes
1+
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
22

33
// Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`.
44
// Note that non-Unpin types should not get `noalias`, matching &mut behavior.

tests/codegen/dst-vtable-align-nonzero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Z merge-functions=disabled
1+
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
22

33
#![crate_type = "lib"]
44
#![feature(core_intrinsics)]

tests/codegen/dst-vtable-size-range.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O -Z merge-functions=disabled
1+
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
22

33
#![crate_type = "lib"]
44
#![feature(core_intrinsics)]

tests/codegen/emscripten-catch-unwind-js-eh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O --target wasm32-unknown-emscripten
1+
//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten
22
//@ needs-llvm-components: webassembly
33

44
// Emscripten has its own unique implementation of catch_unwind (in `codegen_emcc_try`),

tests/codegen/emscripten-catch-unwind-wasm-eh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O --target wasm32-unknown-emscripten -Z emscripten-wasm-eh
1+
//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten -Z emscripten-wasm-eh
22
//@ needs-llvm-components: webassembly
33

44
// Emscripten catch_unwind using wasm exceptions

tests/codegen/enum/enum-bounds-check-derived-idx.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This test checks an optimization that is not guaranteed to work. This test case should not block
22
// a future LLVM update.
3-
//@ compile-flags: -O
3+
//@ compile-flags: -Copt-level=3
44

55
#![crate_type = "lib"]
66

tests/codegen/enum/enum-bounds-check-issue-13926.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This test checks an optimization that is not guaranteed to work. This test case should not block
22
// a future LLVM update.
3-
//@ compile-flags: -O
3+
//@ compile-flags: -Copt-level=3
44

55
#![crate_type = "lib"]
66

tests/codegen/enum/enum-bounds-check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/enum/enum-early-otherwise-branch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/enum/unreachable_enum_default_branch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -O
1+
//@ compile-flags: -Copt-level=3
22

33
#![crate_type = "lib"]
44

tests/codegen/error-provide.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Codegen test for #126242
22

3-
//@ compile-flags: -O
3+
//@ compile-flags: -Copt-level=3
44
#![crate_type = "lib"]
55
#![feature(error_generic_member_access)]
66
use std::error::Request;

tests/codegen/external-no-mangle-statics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ revisions: lib staticlib
22
//@ ignore-emscripten default visibility is hidden
3-
//@ compile-flags: -O
3+
//@ compile-flags: -Copt-level=3
44
//@ [lib] compile-flags: --crate-type lib
55
//@ [staticlib] compile-flags: --crate-type staticlib
66
// `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their

tests/codegen/f128-wasm32-callconv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Verify that Rust implements the expected calling convention for `f128`
22

33
//@ add-core-stubs
4-
//@ compile-flags: -O --target wasm32-wasip1
4+
//@ compile-flags: -Copt-level=3 --target wasm32-wasip1
55
//@ needs-llvm-components: webassembly
66

77
#![crate_type = "lib"]

0 commit comments

Comments
 (0)