about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
2023-10-26Refactor some `char`, `u8` ascii functions to be branchlessokaneco-0/+47
Decompose singular `matches!` with or-patterns to individual `matches!` statements to enable branchless code output. The following functions were changed: - `is_ascii_alphanumeric` - `is_ascii_hexdigit` - `is_ascii_punctuation` Add codegen tests Co-authored-by: George Bateman <george.bateman16@gmail.com> Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
2023-10-23coverage: Add UI tests for values accepted by `-Cinstrument-coverage`Zalathar-1/+31
2023-10-20Rename lots of files that had `generator` in their nameOli Scherer-0/+0
2023-10-20s/generator/coroutine/Oli Scherer-13/+13
2023-10-20s/Generator/Coroutine/Oli Scherer-4/+4
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-34/+40
2023-10-16Add invariant to Vec::pop that len < cap if pop successfulArthur Carcano-0/+24
Fixes: https://github.com/rust-lang/rust/issues/114334
2023-10-14Rollup merge of #116591 - Zalathar:flaky-hash, r=Mark-SimulacrumMatthias Krüger-0/+4
Don't accidentally detect the commit hash as an `fadd` instruction I've seen some reports of `tests/codegen/target-feature-inline-closure.rs` spuriously failing because it thinks the hash in the rustc version number contains an `fadd` instruction. https://github.com/rust-lang/rust/pull/116085#issuecomment-1751174916 https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Is.20.60tests.2Fcodegen.2Ftarget-feature-inline-closure.2Ers.60.20flakey https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Strange.20.5Cn.20in.20output.20of.20assert.20.23108341/near/395811335 This PR tries to make that not happen by adding a `CHECK-LABEL` directive that will match the line with the rustc version string, preventing the previous `CHECK-NOT` from seeing it.
2023-10-12Auto merge of #116510 - scottmcm:no-1-simd-v2, r=compiler-errorsbors-0/+55
Copy 1-element arrays as scalars, not vectors For `[T; 1]` it's silly to copy as `<1 x T>` when we can just copy as `T`. Inspired by https://github.com/rust-lang/rust/issues/101210#issuecomment-1732470941, which pointed out that `Option<[u8; 1]>` was codegenning worse than `Option<u8>`. (I'm not sure *why* LLVM doesn't optimize out `<1 x u8>`, but might as well just not emit it in the first place in this codepath.) --- I think I bit off too much in #116479; let me try just the scalar case first. r? `@ghost`
2023-10-10Don't accidentally detect the commit hash as an `fadd` instructionZalathar-0/+4
2023-10-08Ignore MSVC in test.Camille GILLOT-0/+1
2023-10-08Make FnDef 1-ZST in LLVM debuginfo.Camille GILLOT-0/+17
2023-10-07Copy 1-element arrays as scalars, not vectorsScott McMurray-0/+55
For `[T; 1]` it's silly to copy as `<1 x T>` when we can just copy as `T`.
2023-10-06Auto merge of #116018 - DianQK:simd-wide-sum-test, r=scottmcmbors-13/+13
Increasing the SIMD size improves the vectorization possibilities Change the `simd-wide-sum.rs` to pass tests based on the LLVM main branch. For smaller lengths, we cannot expect to always get vectorized. A related discussion at https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/LLVM.20HEAD.3A.20codegen.2Fsimd.2Fsimd-wide-sum.2Ers.20newly.20failing. r? scottmcm
2023-10-06Add a wishlist FIXMEscottmcm-0/+2
2023-10-02Limit to LLVM 17.0.2 to work around WinEH codegen bugNikita Popov-1/+3
2023-10-02Fix codegen tests on panic=abort targetsNikita Popov-2/+2
2023-10-02Reapply: Mark drop calls in landing pads cold instead of noinlineErik Desjardins-0/+75
Co-authored-by: Max Fan <git@max.fan> Co-authored-by: Nikita Popov <npopov@redhat.com>
2023-09-24Auto merge of #104385 - BlackHoleFox:apple-minimum-bumps, r=petrochenkovbors-6/+6
Raise minimum supported Apple OS versions This implements the proposal to raise the minimum supported Apple OS versions as laid out in the now-completed MCP (https://github.com/rust-lang/compiler-team/issues/556). As of this PR, rustc and the stdlib now support these versions as the baseline: - macOS: 10.12 Sierra - iOS: 10 - tvOS: 10 - watchOS: 5 (Unchanged) In addition to everything this breaks indirectly, these changes also erase the `armv7-apple-ios` target (currently tier 3) because the oldest supported iOS device now uses ARMv7s. Not sure what the policy around tier3 target removal is but shimming it is not an option due to the linker refusing. [Per comment](https://github.com/rust-lang/compiler-team/issues/556#issuecomment-1297175073), this requires a FCP to merge. cc `@wesleywiser.`
2023-09-24Only check for successful vectorization on wider_reduce_into_iterDianQK-3/+1
Different vectorization results are due to different LLVM versions.
2023-09-23Raise minimum supported macOS to 10.12BlackHoleFox-6/+6
2023-09-23Auto merge of #107421 - cjgillot:drop-tracking-mir, r=oli-obkbors-6/+4
Enable -Zdrop-tracking-mir by default This PR enables the `drop-tracking-mir` flag by default. This flag was initially implemented in https://github.com/rust-lang/rust/pull/101692. This flag computes auto-traits on generators based on their analysis MIR, instead of trying to compute on the HIR body. This removes the need for HIR-based drop-tracking, as we can now reuse the same code to compute generator witness types and to compute generator interior fields.
2023-09-23Auto merge of #116047 - a-lafrance:I80836-codegen-test, r=Mark-Simulacrumbors-0/+17
Add codegen test to guard against VecDeque optimization regression Very small PR that adds a codegen test to guard against regression for the `VecDeque` optimization addressed in #80836. Ensures that Rustc optimizes away the panic when unwrapping the result of `.get(0)` because of the `!is_empty()` condition.
2023-09-23Make test more robust to opts.Camille GILLOT-6/+4
2023-09-23Auto merge of #115695 - tmiasko:compiletest-supported-sanitizers, r=oli-obkbors-10/+14
compiletest: load supported sanitizers from target spec
2023-09-22Fix test on targets with crt-static defaultTomasz Miąsko-10/+14
2023-09-21Add test to guard against VecDeque optimization regressionArthur Lafrance-0/+17
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-2/+2
2023-09-21Increasing the SIMD size improves the vectorization possibilitiesDianQK-13/+13
Change the simd-wide-sum.rs to pass the LLVM main branching test.
2023-09-20Auto merge of #115734 - tmiasko:kcfi-no-core, r=compiler-errorsbors-1/+12
Use no_core for KCFI tests to exercise them in CI
2023-09-11Rollup merge of #115591 - djkoloski:issue_115385, r=cuviperMatthias Krüger-0/+46
Add regression test for LLVM 17-rc3 miscompile Closes #115385, see that issue for more details.
2023-09-11Use no_core for KCFI tests to exercise them in CITomasz Miąsko-1/+12
2023-09-08Auto merge of #115417 - dpaoliello:fixdi, r=wesleywiserbors-0/+28
Use the same DISubprogram for each instance of the same inlined function within a caller # Issue Details: The call to `panic` within a function like `Option::unwrap` is translated to LLVM as a `tail call` (as it will never return), when multiple calls to the same function like this are inlined LLVM will notice the common `tail call` block (i.e., loading the same panic string + location info and then calling `panic`) and merge them together. When merging these instructions together, LLVM will also attempt to merge the debug locations as well, but this fails (i.e., debug info is dropped) as Rust emits a new `DISubprogram` at each inline site thus LLVM doesn't recognize that these are actually the same function and so thinks that there isn't a common debug location. As an example of this, consider the following program: ```rust #[no_mangle] fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 { let x1 = x.unwrap(); let y1 = y.unwrap(); x1 + y1 } ``` When building for x86_64 Windows using 1.72 it generates (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction): ```llvm .cv_loc 0 1 3 0 # src\lib.rs:3:0 addq $40, %rsp retq leaq .Lalloc_f570dea0a53168780ce9a91e67646421(%rip), %rcx leaq .Lalloc_629ace53b7e5b76aaa810d549cc84ea3(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17h12e60b9063f6dee8E int3 ``` # Fix Details: Cache the `DISubprogram` emitted for each inlined function instance within a caller so that this can be reused if that instance is encountered again. Ideally, we would also deduplicate child scopes and variables, however my attempt to do that with #114643 resulted in asserts when building for Linux (#115156) which would require some deep changes to Rust to fix (#115455). Instead, when using an inlined function as a debug scope, we will also create a new child scope such that subsequent child scopes and variables do not collide (from LLVM's perspective). After this change the above assembly now (with <https://reviews.llvm.org/D159226> as well) shows the `panic!` was inlined from `unwrap` in `option.rs` at line 935 into the current function in `lib.rs` at line 0 (line 0 is emitted since it is ambiguous which line to use as there were two inline sites that lead to this same code): ```llvm .cv_loc 0 1 3 0 # src\lib.rs:3:0 addq $40, %rsp retq .cv_inline_site_id 6 within 0 inlined_at 1 0 0 .cv_loc 6 2 935 0 # library\core\src\option.rs:935:0 leaq .Lalloc_5f55955de67e57c79064b537689facea(%rip), %rcx leaq .Lalloc_e741d4de8cb5801e1fd7a6c6795c1559(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17hde1558f32d5b1c04E int3 ```
2023-09-08Auto merge of #115372 - RalfJung:abi-assert-eq, r=davidtwcobors-1/+0
add rustc_abi(assert_eq) to test some guaranteed or at least highly expected ABI compatibility guarantees This new repr(transparent) test is super useful, it would have found https://github.com/rust-lang/rust/issues/115336 and found https://github.com/rust-lang/rust/issues/115404, https://github.com/rust-lang/rust/issues/115481, https://github.com/rust-lang/rust/issues/115509.
2023-09-07add support for rustc_abi(assert_eq) and use it to test some ↵Ralf Jung-1/+0
repr(transparent) cases
2023-09-06Address feedbackDavid Koloski-8/+4
2023-09-06Auto merge of #114946 - anforowicz:generic-fix-for-asan-lto, r=tmiaskobors-0/+43
Preserve ASAN-related symbols during LTO. Fixes https://github.com/rust-lang/rust/issues/113404
2023-09-06Add regression test for LLVM 17-rc3 miscompileDavid Koloski-0/+50
See #115385 for more details.
2023-09-02Auto merge of #115273 - the8472:take-fold, r=cuviperbors-0/+15
Optimize Take::{fold, for_each} when wrapping TrustedRandomAccess iterators
2023-09-02restrict test to x86-64The 8472-0/+1
2023-09-01Deduplicate inlined function debug info, but create a new lexical scope to ↵Daniel Paoliello-0/+28
child subsequent scopes and variables from colliding
2023-09-01update tests that are ignored by debugDing Xiang Fei-6/+6
2023-08-29Preserve `___asan_globals_registered` symbol during LTO.Lukasz Anforowicz-0/+43
Fixes https://github.com/rust-lang/rust/issues/113404
2023-08-29Auto merge of #115260 - scottmcm:not-quite-so-cold, r=WaffleLapkinbors-2/+11
Use `preserve_mostcc` for `extern "rust-cold"` As experimentation in #115242 has shown looks better than `coldcc`. Notably, clang exposes `preserve_most` (https://clang.llvm.org/docs/AttributeReference.html#preserve-most) but not `cold`, so this change should put us on a better-supported path. And *don't* use a different convention for cold on Windows, because that actually ends up making things worse. (See comment in the code.) cc tracking issue #97544
2023-08-28Auto merge of #115050 - khei4:khei4/codegen-move-before-nocapture, r=nikicbors-0/+22
add codegen test for the move before passing to nocapture, by shared-ref arg This PR adds codegen test for https://github.com/rust-lang/rust/issues/107436#issuecomment-1685792517 (It seems like this works from llvm-16?) Fixes #107436
2023-08-27Auto merge of #115231 - saethlin:dont-ignore-wasm, r=Mark-Simulacrumbors-1/+0
Remove some wasm/emscripten ignores I'm planning on landing a few PRs like this that remove ignores that aren't required. This just covers mir-opt and codegen tests.
2023-08-27Auto merge of #115139 - cjgillot:llvm-fragment, r=nikicbors-0/+46
Do not forget to pass DWARF fragment information to LLVM. Fixes https://github.com/rust-lang/rust/issues/115113 for the rustc part
2023-08-27Optimize Take::{fold, for_each} when wrapping TrustedRandomAccess iteratorsThe 8472-0/+14
2023-08-27Rollup merge of #114957 - loongarch-rs:fix-tests, r=Mark-SimulacrumMatthias Krüger-2/+2
tests: Fix tests for LoongArch64 This PR fixes `lp64d abi` tests for LoongArch64.
2023-08-26Use `preserve_mostcc` for `extern "rust-cold"`Scott McMurray-2/+11
As experimentation in 115242 has shown looks better than `coldcc`. And *don't* use a different convention for cold on Windows, because that actually ends up making things worse. cc tracking issue 97544