diff options
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/async-fn-debug-awaitee-field.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/async-fn-debug-msvc.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/char-ascii-branchless.rs | 47 | ||||
| -rw-r--r-- | tests/codegen/coroutine-debug-msvc.rs (renamed from tests/codegen/generator-debug-msvc.rs) | 12 | ||||
| -rw-r--r-- | tests/codegen/coroutine-debug.rs (renamed from tests/codegen/generator-debug.rs) | 14 | ||||
| -rw-r--r-- | tests/codegen/instrument-coverage-off.rs | 23 | ||||
| -rw-r--r-- | tests/codegen/instrument-coverage.rs | 9 |
7 files changed, 93 insertions, 16 deletions
diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs index 29defe68f8b..03cc46cdcde 100644 --- a/tests/codegen/async-fn-debug-awaitee-field.rs +++ b/tests/codegen/async-fn-debug-awaitee-field.rs @@ -1,4 +1,4 @@ -// This test makes sure that the generator field capturing the awaitee in a `.await` expression +// This test makes sure that the coroutine field capturing the awaitee in a `.await` expression // is called "__awaitee" in debuginfo. This name must not be changed since debuggers and debugger // extensions rely on the field having this name. diff --git a/tests/codegen/async-fn-debug-msvc.rs b/tests/codegen/async-fn-debug-msvc.rs index 73c652c9dd1..707a0d27740 100644 --- a/tests/codegen/async-fn-debug-msvc.rs +++ b/tests/codegen/async-fn-debug-msvc.rs @@ -1,4 +1,4 @@ -// Verify debuginfo for generators: +// Verify debuginfo for coroutines: // - Each variant points to the file and line of its yield point // - The discriminants are marked artificial // - Other fields are not marked artificial diff --git a/tests/codegen/char-ascii-branchless.rs b/tests/codegen/char-ascii-branchless.rs new file mode 100644 index 00000000000..b612b24c7c7 --- /dev/null +++ b/tests/codegen/char-ascii-branchless.rs @@ -0,0 +1,47 @@ +// Checks that these functions are branchless. +// +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @is_ascii_alphanumeric_char +#[no_mangle] +pub fn is_ascii_alphanumeric_char(x: char) -> bool { + // CHECK-NOT: br + x.is_ascii_alphanumeric() +} + +// CHECK-LABEL: @is_ascii_alphanumeric_u8 +#[no_mangle] +pub fn is_ascii_alphanumeric_u8(x: u8) -> bool { + // CHECK-NOT: br + x.is_ascii_alphanumeric() +} + +// CHECK-LABEL: @is_ascii_hexdigit_char +#[no_mangle] +pub fn is_ascii_hexdigit_char(x: char) -> bool { + // CHECK-NOT: br + x.is_ascii_hexdigit() +} + +// CHECK-LABEL: @is_ascii_hexdigit_u8 +#[no_mangle] +pub fn is_ascii_hexdigit_u8(x: u8) -> bool { + // CHECK-NOT: br + x.is_ascii_hexdigit() +} + +// CHECK-LABEL: @is_ascii_punctuation_char +#[no_mangle] +pub fn is_ascii_punctuation_char(x: char) -> bool { + // CHECK-NOT: br + x.is_ascii_punctuation() +} + +// CHECK-LABEL: @is_ascii_punctuation_u8 +#[no_mangle] +pub fn is_ascii_punctuation_u8(x: u8) -> bool { + // CHECK-NOT: br + x.is_ascii_punctuation() +} diff --git a/tests/codegen/generator-debug-msvc.rs b/tests/codegen/coroutine-debug-msvc.rs index 9d70ccdef03..6d16e7576c1 100644 --- a/tests/codegen/generator-debug-msvc.rs +++ b/tests/codegen/coroutine-debug-msvc.rs @@ -1,4 +1,4 @@ -// Verify debuginfo for generators: +// Verify debuginfo for coroutines: // - Each variant points to the file and line of its yield point // - The discriminants are marked artificial // - Other fields are not marked artificial @@ -7,10 +7,10 @@ // compile-flags: -C debuginfo=2 // only-msvc -#![feature(generators, generator_trait)] -use std::ops::Generator; +#![feature(coroutines, coroutine_trait)] +use std::ops::Coroutine; -fn generator_test() -> impl Generator<Yield = i32, Return = ()> { +fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> { || { yield 0; let s = String::from("foo"); @@ -20,7 +20,7 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> { // FIXME: No way to reliably check the filename. -// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<generator_debug_msvc::generator_test::generator_env$0>" +// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<coroutine_debug_msvc::coroutine_test::coroutine_env$0>" // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]], // For brevity, we only check the struct name and members of the last variant. // CHECK-SAME: file: [[FILE:![0-9]*]], line: 14, @@ -55,5 +55,5 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> { // CHECK-NOT: flags: DIFlagArtificial fn main() { - let _dummy = generator_test(); + let _dummy = coroutine_test(); } diff --git a/tests/codegen/generator-debug.rs b/tests/codegen/coroutine-debug.rs index 3ec860f2cbc..b060f3bfac7 100644 --- a/tests/codegen/generator-debug.rs +++ b/tests/codegen/coroutine-debug.rs @@ -1,4 +1,4 @@ -// Verify debuginfo for generators: +// Verify debuginfo for coroutines: // - Each variant points to the file and line of its yield point // - The discriminants are marked artificial // - Other fields are not marked artificial @@ -7,10 +7,10 @@ // compile-flags: -C debuginfo=2 --edition=2018 // ignore-msvc -#![feature(generators, generator_trait)] -use std::ops::Generator; +#![feature(coroutines, coroutine_trait)] +use std::ops::Coroutine; -fn generator_test() -> impl Generator<Yield = i32, Return = ()> { +fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> { || { yield 0; let s = String::from("foo"); @@ -20,8 +20,8 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> { // FIXME: No way to reliably check the filename. -// CHECK-DAG: [[GEN_FN:!.*]] = !DINamespace(name: "generator_test" -// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{generator_env#0}", scope: [[GEN_FN]] +// CHECK-DAG: [[GEN_FN:!.*]] = !DINamespace(name: "coroutine_test" +// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{coroutine_env#0}", scope: [[GEN_FN]] // CHECK: [[VARIANT:!.*]] = !DICompositeType(tag: DW_TAG_variant_part, scope: [[GEN]], // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: discriminator: [[DISC:![0-9]*]] @@ -58,5 +58,5 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> { // CHECK-SAME: flags: DIFlagArtificial fn main() { - let _dummy = generator_test(); + let _dummy = coroutine_test(); } diff --git a/tests/codegen/instrument-coverage-off.rs b/tests/codegen/instrument-coverage-off.rs new file mode 100644 index 00000000000..ca803beec0b --- /dev/null +++ b/tests/codegen/instrument-coverage-off.rs @@ -0,0 +1,23 @@ +// Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR. + +// needs-profiler-support +// revisions: n no off false zero +// [n] compile-flags: -Cinstrument-coverage=n +// [no] compile-flags: -Cinstrument-coverage=no +// [off] compile-flags: -Cinstrument-coverage=off +// [false] compile-flags: -Cinstrument-coverage=false +// [zero] compile-flags: -Cinstrument-coverage=0 + +// CHECK-NOT: __llvm_profile_filename +// CHECK-NOT: __llvm_coverage_mapping + +#![crate_type="lib"] + +#[inline(never)] +fn some_function() { + +} + +pub fn some_other_function() { + some_function(); +} diff --git a/tests/codegen/instrument-coverage.rs b/tests/codegen/instrument-coverage.rs index 78f8875a2d9..f8437dac463 100644 --- a/tests/codegen/instrument-coverage.rs +++ b/tests/codegen/instrument-coverage.rs @@ -1,9 +1,16 @@ // Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR. // needs-profiler-support -// compile-flags: -Cinstrument-coverage +// revisions: default y yes on true all +// [default] compile-flags: -Cinstrument-coverage +// [y] compile-flags: -Cinstrument-coverage=y +// [yes] compile-flags: -Cinstrument-coverage=yes +// [on] compile-flags: -Cinstrument-coverage=on +// [true] compile-flags: -Cinstrument-coverage=true +// [all] compile-flags: -Cinstrument-coverage=all // CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}} +// CHECK: @__llvm_coverage_mapping #![crate_type="lib"] |
