rust/tests/codegen
Matthias Krüger d81e444c8e
Rollup merge of #124543 - maurer:llvm-range, r=nikic
codegen tests: Tolerate `range()` qualifications in enum tests

Current LLVM can infer range bounds on the i8s involved with these tests, and annotates it. Accept these bounds if present.

`@rustbot` label: +llvm-main

cc `@durin42`
2024-04-30 06:43:43 +02:00
..
auxiliary
avr
cffi Auto merge of #122053 - erikdesjardins:alloca, r=nikic 2024-04-24 03:00:44 +00:00
cross-crate-inlining
debug-accessibility
dllimports
enum codegen tests: Tolerate range() qualifications in enum tests 2024-04-30 00:02:49 +00:00
float Add basic library support for f16 and f128 2024-04-10 13:50:27 -04:00
instrument-coverage
instrument-xray
intrinsics Fix tests and bless 2024-04-24 13:12:33 +01:00
issues Fix tests and bless 2024-04-24 13:12:33 +01:00
lib-optimizations
loongarch-abi Set writable and dead_on_unwind attributes for sret arguments 2024-04-25 11:43:47 +09:00
macos
meta-filecheck
naked-fn do not add prolog for variadic naked functions 2024-04-12 15:29:39 +03:00
non-terminate
remap_path_prefix
repr add -O to some tests which depend on attributes being added 2024-03-10 16:04:12 -04:00
riscv-abi
sanitizer Fix tests and bless 2024-04-24 13:12:33 +01:00
simd Restore the test checks for wider_reduce_into_iter 2024-03-28 21:28:45 +08:00
simd-intrinsic Fix tests and bless 2024-04-24 13:12:33 +01:00
src-hash-algorithm
unwind-abis Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
aarch64-struct-align-128.rs
abi-efiapi.rs
abi-main-signature-16bit-c-int.rs
abi-main-signature-32bit-c-int.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
abi-repr-ext.rs
abi-sysv64.rs
abi-x86_64_sysv.rs
abi-x86-interrupt.rs
addr-of-mutate.rs
adjustments.rs
align-byval-alignment-mismatch.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
align-byval-vector.rs
align-byval.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
align-enum.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
align-fn.rs
align-offset.rs
align-struct.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
alloc-optimisation.rs
array-clone.rs
array-codegen.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
array-equality.rs Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
array-map.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
array-optimized.rs Remove my scalar_copy_backend_type optimization attempt 2024-04-09 08:51:32 -07:00
ascii-char.rs codegen tests: Tolerate nuw nsw on trunc 2024-04-11 17:20:08 +00:00
asm-clobber_abi.rs
asm-clobbers.rs
asm-goto.rs
asm-may_unwind.rs
asm-maybe-uninit.rs
asm-multiple-options.rs
asm-options.rs
asm-powerpc-clobbers.rs
asm-sanitize-llvm.rs
asm-target-clobbers.rs
async-closure-debug.rs
async-fn-debug-awaitee-field.rs
async-fn-debug-msvc.rs
async-fn-debug.rs
atomic-operations.rs
atomicptr.rs Add the missing inttoptr when we ptrtoint in ptr atomics 2024-03-23 00:07:02 -04:00
autovectorize-f32x4.rs
binary-search-index-no-bound-check.rs
bool-cmp.rs
box-uninit-bytes.rs
bpf-alu32.rs
branch-protection.rs
call-llvm-intrinsics.rs
call-metadata.rs
cast-target-abi.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
catch-unwind.rs
cdylib-external-inline-fns.rs
cf-protection.rs
cfguard-checks.rs
cfguard-disabled.rs
cfguard-nochecks.rs
cfguard-non-msvc.rs
char-ascii-branchless.rs
checked_math.rs Make checked ops emit *unchecked* LLVM operations where feasible 2024-04-18 18:11:21 -07:00
codemodels.rs
coercions.rs
cold-call-declare-and-call.rs
common_prim_int_ptr.rs refine common_prim test 2024-03-13 01:17:15 -04:00
comparison-operators-2-tuple.rs
comparison-operators-newtype.rs
const_scalar_pair.rs Fix tests and bless 2024-04-24 13:12:33 +01:00
constant-branch.rs
consts.rs
coroutine-debug-msvc.rs Error on using yield without also using #[coroutine] on the closure 2024-04-24 08:05:29 +00:00
coroutine-debug.rs Error on using yield without also using #[coroutine] on the closure 2024-04-24 08:05:29 +00:00
dealloc-no-unwind.rs
debug-alignment.rs
debug-column-msvc.rs
debug-column.rs
debug-compile-unit-path.rs
debug-fndef-size.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
debug-limited.rs
debug-line-directives-only.rs
debug-line-tables-only.rs
debug-linkage-name.rs
debug-vtable.rs
debuginfo-constant-locals.rs
debuginfo-generic-closure-env-names.rs
debuginfo-inline-callsite-location.rs
deduced-param-attrs.rs
default-hidden-visibility.rs
default-requires-uwtable.rs
direct-access-external-data.rs
dont_codegen_private_const_fn_only_used_in_const_eval.rs Stop walking the bodies of statics for reachability, and evaluate them instead 2024-03-14 14:10:45 +00:00
drop-in-place-noalias.rs
drop.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
dst-offset.rs use ptradd for vtable indexing 2024-03-10 22:47:30 -04:00
dst-vtable-align-nonzero.rs
dst-vtable-size-range.rs
ehcontguard_disabled.rs
ehcontguard_enabled.rs
emcripten-catch-unwind.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
enable-lto-unit-splitting.rs
export-no-mangle.rs
external-no-mangle-fns.rs
external-no-mangle-statics.rs
fastcall-inreg.rs
fatptr.rs
fewer-names.rs
float_math.rs
fn-impl-trait-self.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
foo.s
force-frame-pointers.rs
force-no-unwind-tables.rs
force-unwind-tables.rs
frame-pointer.rs
function-arguments-noopt.rs
function-arguments.rs Auto merge of #121298 - nikic:writable, r=cuviper 2024-04-25 04:31:56 +00:00
function-return.rs
gdb_debug_script_load.rs
generic-debug.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
global_asm_include.rs
global_asm_x2.rs
global_asm.rs
i128-x86-align.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
infallible-unwrap-in-opt-z.rs
inherit_overflow.rs Codegen const panic messages as function calls 2024-03-22 09:55:50 -04:00
inline-always-works-always.rs
inline-debuginfo.rs
inline-function-args-debug-info.rs
inline-hint.rs
instrument-mcount.rs
integer-cmp.rs
integer-overflow.rs
internalize-closures.rs
intrinsic-no-unnamed-attr.rs
is_val_statically_known.rs
issue-97217.rs
iter-repeat-n-trivial-drop.rs
layout-size-checks.rs
lifetime_start_end.rs
link_section.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
link-dead-code.rs
llvm_module_flags.rs
llvm-ident.rs
loads.rs Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
local-generics-in-exe-internalized.rs
lto-removes-invokes.rs
mainsubprogram.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
mainsubprogramstart.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
match-optimized.rs Transforms match into an assignment statement 2024-04-08 19:00:53 +08:00
match-optimizes-away.rs
match-unoptimized.rs
maybeuninit-rvo.rs Add needs-unwind to codegen test 2024-04-25 11:44:32 +09:00
mem-replace-big-type.rs
mem-replace-simple-type.rs At debuginfo=0, don't inline debuginfo when inlining 2024-04-18 09:35:35 -07:00
merge-functions.rs
method-declaration.rs
mir_zst_stores.rs
mir-inlined-line-numbers.rs
move-before-nocapture-ref-arg.rs Update the minimum external LLVM to 17 2024-03-17 10:11:04 -07:00
move-operands.rs
no_builtins-at-crate.rs
no-assumes-on-casts.rs
no-dllimport-w-cross-lang-lto.rs
no-jump-tables.rs
no-plt.rs
no-redundant-item-monomorphization.rs Port issue-7349 to a codegen test 2024-04-04 21:59:08 +01:00
noalias-box-off.rs
noalias-box.rs
noalias-flag.rs
noalias-refcell.rs
noalias-rwlockreadguard.rs
noalias-unpin.rs
noreturn-uninhabited.rs
noreturnflag.rs
nounwind.rs
nrvo.rs
optimize-attr-1.rs
option-as-slice.rs Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
option-niche-eq.rs Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
overaligned-constant.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
packed.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
panic-abort-windows.rs
panic-in-drop-abort.rs
panic-unwind-default-uwtable.rs
pattern_type_symbols.rs Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
personality_lifetimes.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
pgo-counter-bias.rs
pgo-instrumentation.rs
pic-relocation-model.rs
pie-relocation-model.rs
powerpc64le-struct-align-128.rs Fix argument ABI for overaligned structs on ppc64le 2024-04-08 11:15:36 +09:00
precondition-checks.rs Avoid lowering code under dead SwitchInt targets 2024-03-12 19:01:04 -04:00
ptr-arithmetic.rs
ptr-read-metadata.rs adapt a codegen test for llvm 19 2024-04-29 13:03:45 +00:00
README.md
refs.rs
repeat-trusted-len.rs
riscv-target-abi.rs Set target-abi module flag for RISC-V targets 2024-04-09 05:25:51 +02:00
scalar-pair-bool.rs
set-discriminant-invalid.rs
skip-mono-inside-if-false.rs Avoid lowering code under dead SwitchInt targets 2024-03-12 19:01:04 -04:00
slice_as_from_ptr_range.rs
slice-as_chunks.rs
slice-indexing.rs Use unchecked_sub in str indexing 2024-04-06 14:09:03 -04:00
slice-init.rs
slice-iter-fold.rs
slice-iter-len-eq-zero.rs
slice-iter-nonnull.rs
slice-position-bounds-check.rs
slice-ref-equality.rs Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
slice-reverse.rs
slice-windows-no-bounds-check.rs
some-abis-do-extend-params-to-32-bits.rs
some-global-nonnull.rs
sparc-struct-abi.rs
split-lto-unit.rs
sroa-fragment-debuginfo.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
sse42-implies-crc32.rs
stack-probes-inline.rs
stack-protector.rs
static-relocation-model-msvc.rs
staticlib-external-inline-fns.rs
step_by-overflow-checks.rs Don't emit divide-by-zero panic paths in StepBy::len 2024-04-06 11:37:57 -07:00
stores.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
swap-large-types.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
swap-small-types.rs use [N x i8] for alloca types 2024-04-11 21:42:35 -04:00
target-cpu-on-functions.rs
target-feature-inline-closure.rs
target-feature-overrides.rs
thin-lto.rs
thread-local.rs
tied-features-strength.rs
to_vec.rs
trailing_zeros.rs Update the minimum external LLVM to 17 2024-03-17 10:11:04 -07:00
transmute-optimized.rs Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
transmute-scalar.rs Lower transmutes from int to pointer type as gep on null 2024-03-11 18:19:17 -04:00
try_identity.rs
try_question_mark_nop.rs
tune-cpu-on-functions.rs
tuple-layout-opt.rs
ub-checks.rs Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
unchecked_shifts.rs codegen tests: Tolerate nuw nsw on trunc 2024-04-11 17:20:08 +00:00
unchecked-float-casts.rs
uninit-consts.rs
union-abi.rs
unwind-and-panic-abort.rs
unwind-extern-exports.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
unwind-extern-imports.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
unwind-landingpad-cold.rs
unwind-landingpad-inline.rs
used_with_arg.rs
var-names.rs
vec_pop_push_noop.rs Fix test. 2024-03-29 15:37:43 -07:00
vec-as-ptr.rs
vec-calloc.rs
vec-in-place.rs
vec-iter-collect-len.rs
vec-iter.rs
vec-len-invariant.rs Avoid reloading Vec::len across grow_one in push 2024-04-20 21:07:00 -04:00
vec-optimizes-away.rs
vec-reserve-extend.rs
vec-shrink-panik.rs Update the minimum external LLVM to 17 2024-03-17 10:11:04 -07:00
vec-with-capacity.rs
vecdeque_no_panic.rs
vecdeque_pop_push.rs Add invariant to VecDeque::pop_* that len < cap if pop successful 2024-04-08 12:12:13 +02:00
vecdeque-drain.rs
vecdeque-nonempty-get-no-panic.rs
virtual-function-elimination-32bit.rs
virtual-function-elimination.rs
vtable-upcast.rs use ptradd for vtable indexing 2024-03-10 22:47:30 -04:00
wasm_casts_trapping.rs
wasm_exceptions.rs Update test directives for wasm32-wasip1 2024-03-11 09:36:35 -07:00
zip.rs
zst-offset.rs

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