diff options
| author | bors <bors@rust-lang.org> | 2025-01-11 18:01:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-11 18:01:44 +0000 |
| commit | eb54a50837ad4bcc9842924f27e7287ca66e294c (patch) | |
| tree | a8dc0d72c151ef4dbf4505e246fe35938f344b4d /tests/codegen/min-function-alignment.rs | |
| parent | fb65a3ee576feab95a632eb062f466d7a0342310 (diff) | |
| parent | 076c047fe1f18eb8e396b8f2b27ed258393e6f0f (diff) | |
| download | rust-eb54a50837ad4bcc9842924f27e7287ca66e294c.tar.gz rust-eb54a50837ad4bcc9842924f27e7287ca66e294c.zip | |
Auto merge of #135370 - matthiaskrgr:rollup-g2w6d5n, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #134030 (add `-Zmin-function-alignment`) - #134776 (Avoid ICE: Account for `for<'a>` types when checking for non-structural type in constant as pattern) - #135205 (Rename `BitSet` to `DenseBitSet`) - #135314 (Eagerly collect mono items for non-generic closures) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen/min-function-alignment.rs')
| -rw-r--r-- | tests/codegen/min-function-alignment.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/codegen/min-function-alignment.rs b/tests/codegen/min-function-alignment.rs new file mode 100644 index 00000000000..7c0ad12402a --- /dev/null +++ b/tests/codegen/min-function-alignment.rs @@ -0,0 +1,43 @@ +//@ revisions: align16 align1024 +//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 +//@ [align16] compile-flags: -Zmin-function-alignment=16 +//@ [align1024] compile-flags: -Zmin-function-alignment=1024 + +#![crate_type = "lib"] +#![feature(fn_align)] + +// functions without explicit alignment use the global minimum +// +// CHECK-LABEL: @no_explicit_align +// align16: align 16 +// align1024: align 1024 +#[no_mangle] +pub fn no_explicit_align() {} + +// CHECK-LABEL: @lower_align +// align16: align 16 +// align1024: align 1024 +#[no_mangle] +#[repr(align(8))] +pub fn lower_align() {} + +// the higher value of min-function-alignment and repr(align) wins out +// +// CHECK-LABEL: @higher_align +// align16: align 32 +// align1024: align 1024 +#[no_mangle] +#[repr(align(32))] +pub fn higher_align() {} + +// cold functions follow the same rules as other functions +// +// in GCC, the `-falign-functions` does not apply to cold functions, but +// `-Zmin-function-alignment` applies to all functions. +// +// CHECK-LABEL: @no_explicit_align_cold +// align16: align 16 +// align1024: align 1024 +#[no_mangle] +#[cold] +pub fn no_explicit_align_cold() {} |
