rust/tests/codegen
bors 7d7de5bf3c Auto merge of #139088 - spastorino:ergonomic-ref-counting-2, r=nikomatsakis
Ergonomic ref counting: optimize away clones when possible

This PR build on top of https://github.com/rust-lang/rust/pull/134797. It optimizes codegen of ergonomic ref-counting when the type being `use`d is only known to be copy after monomorphization. We avoid codening a clone and generate bitwise copy instead.

RFC: https://github.com/rust-lang/rfcs/pull/3680
Tracking issue: https://github.com/rust-lang/rust/issues/132290
Project goal: https://github.com/rust-lang/rust-project-goals/issues/107

r? `@nikomatsakis`

This PR could better sit on top of https://github.com/rust-lang/rust/pull/131650 but as it did not land yet I've decided to just do minimal changes. It may be the case that doing what I'm doing regress the performance and we may need to go the full route of https://github.com/rust-lang/rust/pull/131650.
cc `@saethlin` in this regard.
2025-04-10 09:08:23 +00:00
..
asm Use explicit cpu in some asm and codegen tests. 2025-03-19 19:45:46 +01:00
autodiff move old tests, add sret test 2025-04-07 07:11:52 -04:00
auxiliary Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
avr update/bless tests 2025-04-06 21:41:47 +02:00
bounds-checking Simplify the GEP instruction for index 2024-12-15 19:01:45 +08:00
cffi Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
compiletest-self-test tests/codegen: add minicore compiletest self-test 2024-10-31 18:20:11 +08:00
cross-crate-inlining tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
debug-accessibility Explicitly register MSVC/NONMSVC revisions for some codegen tests 2024-12-19 20:36:51 +08:00
debuginfo-proc-macro Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
dllimports Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
enum Address PR feedback 2025-04-07 18:12:06 -07:00
ergonomic-clones Add codegen test to be sure we get rid of uneeded clones after monomorphization 2025-04-07 16:53:11 -03:00
float Expose algebraic floating point intrinsics 2025-04-04 16:13:57 -07:00
hint tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
instrument-coverage coverage: Adjust a codegen test to ignore the order of covmap/covfun globals 2024-12-11 21:34:48 +11:00
instrument-xray [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
intrinsics update/bless tests 2025-04-06 21:41:47 +02:00
issues Rollup merge of #139438 - Zalathar:fix-test-122600, r=scottmcm 2025-04-06 16:21:03 +10:00
lib-optimizations tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
loongarch-abi tests: use minicore more 2025-02-24 09:26:54 +00:00
macos tests: use minicore more 2025-02-24 09:26:54 +00:00
meta-filecheck compiletest: don't register MSVC/NONMSVC FileCheck prefixes 2024-12-19 20:36:51 +08:00
naked-fn naked functions: on windows emit .endef without the symbol name 2025-03-11 00:27:32 +01:00
non-terminate Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
patchable-function-entry Updated code for changes to RFC, added additional error handling, added 2024-06-25 19:00:02 +02:00
remap_path_prefix Avoid wrapping constant allocations in packed structs when not necessary 2025-03-28 09:19:57 +00:00
repr tests: use minicore more 2025-02-24 09:26:54 +00:00
riscv-abi tests: use minicore more 2025-02-24 09:26:54 +00:00
sanitizer KCFI: Add KCFI arity indicator support 2025-04-05 04:05:04 +00:00
simd use the right feature in codegen tests 2025-02-27 12:23:00 +01:00
simd-intrinsic remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
src-hash-algorithm [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
unwind-abis Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
aarch64-softfloat.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
aarch64-struct-align-128.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
abi-efiapi.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
abi-main-signature-16bit-c-int.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
abi-main-signature-32bit-c-int.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
abi-repr-ext.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
abi-sysv64.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
abi-win64-zst.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
abi-x86-interrupt.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
abi-x86-sse.rs x86-sse2 ABI: use SSE registers for floats and SIMD 2025-02-18 16:11:41 +01:00
abi-x86_64_sysv.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
addr-of-mutate.rs LLVM changed the nocapture attribute to captures(none) 2025-01-30 11:22:46 +01:00
adjustments.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
align-byval-alignment-mismatch.rs use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
align-byval-vector.rs use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
align-byval.rs use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
align-enum.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
align-fn.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
align-offset.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
align-struct.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
alloc-optimisation.rs Remove implicit #[no_mangle] for #[rustc_std_internal_symbol] 2025-03-17 14:08:09 +00:00
amdgpu-addrspacecast.rs Cast allocas to default address space 2025-02-10 21:38:44 +01:00
array-clone.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
array-cmp.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
array-codegen.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
array-equality.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
array-from_fn.rs test(std): Add codegen test for array::from_fn optimization 2024-08-10 10:44:24 +08:00
array-map.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
array-optimized.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
array-repeat.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
ascii-char.rs codegen tests: Tolerate nuw nsw on trunc 2024-04-11 17:20:08 +00:00
assign-desugar-debuginfo.rs Don't produce debug information for compiler-introduced-vars when desugaring assignments. 2025-03-21 17:34:45 -07:00
async-closure-debug.rs Stabilize async closures 2024-12-13 00:04:56 +00:00
async-fn-debug-awaitee-field.rs Explicitly register MSVC/NONMSVC revisions for some codegen tests 2024-12-19 20:36:51 +08:00
async-fn-debug-msvc.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
async-fn-debug.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
atomic-operations.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
atomicptr.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
autovectorize-f32x4.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
bigint-helpers.rs Override disjoint_or in the LLVM backend 2025-01-31 22:29:08 -08:00
binary-heap-peek-mut-pop-no-panic.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
binary-search-index-no-bound-check.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
bool-cmp.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
box-default-debug-copies.rs reduce Box::default stack copies in debug mode 2025-01-26 03:48:27 -05:00
box-uninit-bytes.rs Remove implicit #[no_mangle] for #[rustc_std_internal_symbol] 2025-03-17 14:08:09 +00:00
bpf-alu32.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
branch-protection.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
call-llvm-intrinsics.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
cast-optimized.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
cast-target-abi.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
catch-unwind.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
cdylib-external-inline-fns.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
cf-protection.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
cfguard-checks.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
cfguard-disabled.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
cfguard-nochecks.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
cfguard-non-msvc.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
char-ascii-branchless.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
char-escape-debug-no-bounds-check.rs Add test for escape_debug without bounds check. 2025-03-06 21:38:39 +01:00
checked_ilog.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
checked_math.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
clone-shims.rs Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
clone_as_copy.rs Remove unsound-mir-opts for simplify_aggregate_to_copy 2025-04-03 21:59:43 +08:00
codemodels.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
coercions.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
cold-call-declare-and-call.rs Disallow setting built-in cfgs via set the command-line 2024-08-07 14:08:34 +02:00
common_prim_int_ptr.rs llvm: Tolerate captures in tests 2025-02-14 18:55:50 +00:00
comparison-operators-2-struct.rs Update some comparison tests now that they pass in LLVM20 2025-02-17 16:36:14 -08:00
comparison-operators-2-tuple.rs Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics 2025-03-06 22:29:05 +08:00
comparison-operators-newtype.rs Set signext or zeroext for integer arguments on RISC-V 2024-10-23 04:42:03 +02:00
const-array.rs Avoid wrapping constant allocations in packed structs when not necessary 2025-03-28 09:19:57 +00:00
const-vector.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
const_scalar_pair.rs Fix tests and bless 2024-04-24 13:12:33 +01:00
constant-branch.rs Compute reachable locals as part of non_ssa_locals 2024-09-21 01:07:00 -04:00
consts.rs Use FileCheck to parameterize codegen tests over hashes 2024-06-04 01:30:51 -07:00
coroutine-debug-msvc.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
coroutine-debug.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
dealloc-no-unwind.rs Remove implicit #[no_mangle] for #[rustc_std_internal_symbol] 2025-03-17 14:08:09 +00:00
debug-alignment.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
debug-column-msvc.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
debug-column.rs Enable more tests on Windows 2025-02-03 10:39:32 -05:00
debug-compile-unit-path.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
debug-fndef-size.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
debug-limited.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
debug-line-directives-only.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
debug-line-tables-only.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
debug-linkage-name.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
debug-vtable.rs Avoid wrapping constant allocations in packed structs when not necessary 2025-03-28 09:19:57 +00:00
debuginfo-constant-locals.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
debuginfo-generic-closure-env-names.rs Explicitly register MSVC/NONMSVC revisions for some codegen tests 2024-12-19 20:36:51 +08:00
debuginfo-inline-callsite-location.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
deduced-param-attrs.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
default-requires-uwtable.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
default-visibility.rs Use Default visibility for rustc-generated C symbol declarations 2024-10-11 08:43:27 +11:00
direct-access-external-data.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
dont-shuffle-bswaps.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
dont_codegen_private_const_fn_only_used_in_const_eval.rs Also support generic constants 2024-06-05 15:40:11 +00:00
drop-in-place-noalias.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
drop.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
dst-offset.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
dst-vtable-align-nonzero.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
dst-vtable-size-range.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
ehcontguard_disabled.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
ehcontguard_enabled.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
emscripten-catch-unwind-js-eh.rs update/bless tests 2025-04-06 21:41:47 +02:00
emscripten-catch-unwind-wasm-eh.rs update/bless tests 2025-04-06 21:41:47 +02:00
enable-lto-unit-splitting.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
error-provide.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
export-no-mangle.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
external-no-mangle-fns.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
external-no-mangle-statics.rs Avoid wrapping constant allocations in packed structs when not necessary 2025-03-28 09:19:57 +00:00
f128-wasm32-callconv.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
fastcall-inreg.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
fatptr.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
fewer-names.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
fixed-x18.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
float_math.rs Expose algebraic floating point intrinsics 2025-04-04 16:13:57 -07:00
fn-impl-trait-self.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
force-frame-pointers.rs test: ignore force-frame-pointers test on some targets 2024-06-23 00:40:43 -07:00
force-no-unwind-tables.rs Enable more tests on Windows 2025-02-03 10:39:32 -05:00
force-unwind-tables.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
frame-pointer.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
function-arguments-noopt.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
function-arguments.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
function-return.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
gdb_debug_script_load.rs remove support for the #[start] attribute 2025-01-21 06:59:15 -07:00
generic-debug.rs reenable some windows tests 2024-07-14 13:48:29 +03:00
gep-index.rs Also use gep inbounds nuw for index projections 2025-02-19 15:15:29 +01:00
gpu-kernel-abi.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
i128-wasm32-callconv.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
i128-x86-align.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
i128-x86-callconv.rs x86_win64 ABI: do not use xmm0 with softfloat ABI 2025-02-19 08:41:19 +01:00
infallible-unwrap-in-opt-z.rs Ignore less tests in debug builds 2024-02-23 18:04:01 -05:00
inherit_overflow.rs Codegen const panic messages as function calls 2024-03-22 09:55:50 -04:00
inline-always-works-always.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
inline-debuginfo.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
inline-function-args-debug-info.rs Rework MIR inlining debuginfo so function parameters show up in debuggers. 2024-08-12 19:20:00 -07:00
inline-hint.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
instrument-mcount.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
integer-cmp.rs Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics 2025-03-06 22:29:05 +08:00
integer-overflow.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
internalize-closures.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
intrinsic-no-unnamed-attr.rs update/bless tests 2025-04-06 21:41:47 +02:00
is_val_statically_known.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
issue-97217.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
iter-repeat-n-trivial-drop.rs Remove implicit #[no_mangle] for #[rustc_std_internal_symbol] 2025-03-17 14:08:09 +00:00
layout-size-checks.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
lifetime_start_end.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
link-dead-code.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
link_section.rs Avoid wrapping constant allocations in packed structs when not necessary 2025-03-28 09:19:57 +00:00
llvm-ident.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
llvm_module_flags.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
loads.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
local-generics-in-exe-internalized.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
lto-removes-invokes.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
mainsubprogram.rs reenable some windows tests 2024-07-14 13:48:29 +03:00
match-optimized.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
match-optimizes-away.rs Don't alloca just to look at a discriminant 2025-03-12 00:56:43 -07:00
match-unoptimized.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
maybeuninit-rvo.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
mem-replace-big-type.rs We don't need NonNull::as_ptr debuginfo 2024-12-10 01:29:43 -08:00
mem-replace-simple-type.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
merge-functions.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
method-declaration.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
min-function-alignment.rs add -Zmin-function-alignment 2025-01-10 22:53:54 +01:00
mir-aggregate-no-alloca.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
mir-inlined-line-numbers.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
mir_zst_stores.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
move-before-nocapture-ref-arg.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
move-operands.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
naked-asan.rs fix the naked-asan test 2024-12-10 21:41:05 +01:00
no-alloca-inside-if-false.rs Compute reachable locals as part of non_ssa_locals 2024-09-21 01:07:00 -04:00
no-assumes-on-casts.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
no-dllimport-w-cross-lang-lto.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
no-jump-tables.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
no-plt.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
no-redundant-item-monomorphization.rs Port issue-7349 to a codegen test 2024-04-04 21:59:08 +01:00
no_builtins-at-crate.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
noalias-box-off.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
noalias-box.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
noalias-flag.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
noalias-freeze.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
noalias-refcell.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
noalias-rwlockreadguard.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
noalias-unpin.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
noreturn-uninhabited.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
noreturnflag.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
nounwind.rs reenable some windows tests 2024-07-14 13:48:29 +03:00
nrvo.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
optimize-attr-1.rs Implement optimize(none) attribute 2025-01-23 17:19:53 +00:00
option-as-slice.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
option-niche-eq.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
overaligned-constant.rs The embedded bitcode should always be prepared for LTO/ThinLTO 2025-02-23 21:23:36 +08:00
packed.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
panic-abort-windows.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
panic-in-drop-abort.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
panic-unwind-default-uwtable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
pattern_type_symbols.rs Hide the end of ranges in pretty printing if it's also the maximum of the type 2025-03-06 10:50:23 +00:00
personality_lifetimes.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
pgo-counter-bias.rs Use -Zno-profiler-runtime instead of //@ needs-profiler-support 2024-06-14 13:31:46 +10:00
pgo-instrumentation.rs Use -Zno-profiler-runtime instead of //@ needs-profiler-support 2024-06-14 13:31:46 +10:00
pic-relocation-model.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
pie-relocation-model.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
placement-new.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
powerpc64le-struct-align-128.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
precondition-checks.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
ptr-arithmetic.rs Emit getelementptr inbounds nuw for pointer::add() 2025-02-19 11:32:32 +01:00
ptr-read-metadata.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
range-attribute.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
range-loop.rs Allow more top-down inlining for single-BB callees 2025-03-12 22:39:43 -07:00
range_to_inclusive.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
README.md
refs.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
reg-struct-return.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
regparm-inreg.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
repeat-trusted-len.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
riscv-target-abi.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
rust-abi-arch-specific-adjustment.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
s390x-simd.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
scalar-pair-bool.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
set-discriminant-invalid.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
skip-mono-inside-if-false.rs Avoid lowering code under dead SwitchInt targets 2024-03-12 19:01:04 -04:00
slice-as_chunks.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
slice-indexing.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
slice-init.rs Add a test 2025-03-02 18:53:49 +00:00
slice-is-ascii.rs Use explicit cpu in some asm and codegen tests. 2025-03-19 19:45:46 +01:00
slice-iter-fold.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
slice-iter-len-eq-zero.rs transmute should also assume non-null pointers 2025-02-12 23:01:27 -08:00
slice-iter-nonnull.rs Simplify slice::Iter::next enough that it inlines 2025-02-14 22:24:27 -08:00
slice-last-elements-optimization.rs Add tests for LLVM 20 slice bounds check optimization 2025-03-31 22:38:53 +09:00
slice-pointer-nonnull-unwrap.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
slice-position-bounds-check.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
slice-ref-equality.rs Set both nuw and nsw in slice size calculation 2025-02-13 21:26:48 -08:00
slice-reverse.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
slice-split-at.rs slice: Remove some uses of unsafe in first/last chunk methods 2025-03-30 12:45:04 -04:00
slice-windows-no-bounds-check.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
slice_as_from_ptr_range.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
some-abis-do-extend-params-to-32-bits.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
some-global-nonnull.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
sparc-struct-abi.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
split-lto-unit.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
sroa-fragment-debuginfo.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
sse42-implies-crc32.rs Fix codegen tests 2024-08-07 00:41:48 -04:00
stack-probes-inline.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
stack-protector.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
static-relocation-model-msvc.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
staticlib-external-inline-fns.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
step_by-overflow-checks.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
stores.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
string-push.rs Speed up String::push and String::insert 2025-04-09 13:06:10 +03:00
swap-large-types.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
swap-small-types.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
target-cpu-on-functions.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
target-feature-inline-closure.rs Fix target-feature inline test to be less flaky 2025-03-06 19:56:21 +00:00
target-feature-overrides.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
terminating-catchpad.rs Generate correct terminate block under Wasm EH 2025-02-06 18:21:13 +03:00
thread-local.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
tied-features-strength.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
to_vec.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
trailing_zeros.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
transmute-optimized.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
transmute-scalar.rs Emit trunc nuw for unchecked shifts and to_immediate_scalar 2025-02-19 11:36:52 -08:00
try_question_mark_nop.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
tune-cpu-on-functions.rs Run rustfmt on tests/codegen/. 2024-05-31 15:56:43 +10:00
tuple-layout-opt.rs Fix test expectations for 32bit x86 2024-10-19 13:09:21 +00:00
ub-checks.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
unchecked-float-casts.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
unchecked_shifts.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
uninhabited-transparent-return-abi.rs tests: fix up new test for nocapture -> capture(none) change 2025-02-25 17:46:05 -05:00
uninit-consts.rs Avoid wrapping constant allocations in packed structs when not necessary 2025-03-28 09:19:57 +00:00
uninit-repeat-in-aggregate.rs Lower to a memset(undef) when Rvalue::Repeat repeats uninit 2025-03-19 23:57:49 -04:00
union-abi.rs Emit trunc nuw for unchecked shifts and to_immediate_scalar 2025-02-19 11:36:52 -08:00
unwind-and-panic-abort.rs Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
unwind-extern-exports.rs Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
unwind-extern-imports.rs Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
unwind-landingpad-cold.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
unwind-landingpad-inline.rs Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
used_with_arg.rs
var-names.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-as-ptr.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-calloc.rs Remove implicit #[no_mangle] for #[rustc_std_internal_symbol] 2025-03-17 14:08:09 +00:00
vec-in-place.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-iter-collect-len.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-iter.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-len-invariant.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-optimizes-away.rs Remove implicit #[no_mangle] for #[rustc_std_internal_symbol] 2025-03-17 14:08:09 +00:00
vec-reserve-extend.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-shrink-panik.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec-with-capacity.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vec_pop_push_noop.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
vecdeque-drain.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vecdeque-nonempty-get-no-panic.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vecdeque_no_panic.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vecdeque_pop_push.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
virtual-call-attrs-issue-137646.rs Don't infer unwinding of virtual calls based on the function attributes 2025-02-27 12:58:18 +08:00
virtual-function-elimination-32bit.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
virtual-function-elimination.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vtable-loads.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
vtable-upcast.rs remove feature(trait_upcasting) from tests and bless them 2025-02-06 23:44:23 +01:00
wasm_casts_trapping.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
wasm_exceptions.rs Fix tests/codegen/wasm_exceptions 2025-01-28 19:10:26 +03:00
zip.rs tests/codegen: use -Copt-level=3 instead of -O 2025-02-11 13:41:35 -08:00
zst-offset.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00

The files here use the LLVM FileCheck framework, documented at https://llvm.org/docs/CommandGuide/FileCheck.html.

One extension worth noting is the use of revisions as custom prefixes for FileCheck. If your codegen test has different behavior based on the chosen target or different compiler flags that you want to exercise, you can use a revisions annotation, like so:

// revisions: aaa bbb
// [bbb] compile-flags: --flags-for-bbb

After specifying those variations, you can write different expected, or explicitly unexpected output by using <prefix>-SAME: and <prefix>-NOT:, like so:

// CHECK: expected code
// aaa-SAME: emitted-only-for-aaa
// aaa-NOT:                        emitted-only-for-bbb
// bbb-NOT:  emitted-only-for-aaa
// bbb-SAME:                       emitted-only-for-bbb