about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
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-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-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
2023-08-26Restrict test to x86_64.Camille GILLOT-0/+3
2023-08-26Do not produce fragment for ZST.Camille GILLOT-8/+6
2023-08-26Add test with non-ZST.Camille GILLOT-13/+31
2023-08-26Do not forget to pass DWARF fragment information to LLVM.Camille GILLOT-0/+27
2023-08-26add codegen test for #107436khei4-0/+22
remove trailing whitespace, add trailing newline fix llvm version and function name
2023-08-26Auto merge of #115232 - wesleywiser:revert_114643, r=tmiaskobors-26/+0
Revert "Use the same DISubprogram for each instance of the same inline function within the caller" This reverts commit 687bffa49375aa00bacc51f5d9adfb84a9453e17. Reverting to resolve ICEs reported on nightly. cc `@dpaoliello` Fixes #115156
2023-08-25Stop emitting non-power-of-two vectors in basic LLVM codegenScott McMurray-15/+39
2023-08-25Revert "Use the same DISubprogram for each instance of the same inlined ↵Wesley Wiser-26/+0
function within the caller" This reverts commit 687bffa49375aa00bacc51f5d9adfb84a9453e17. Reverting to resolve ICEs reported on nightly.
2023-08-25Remove some wasm/emscripten ignoresBen Kimock-1/+0
2023-08-24Fix CFI: f32 and f64 are encoded incorrectly for cRamon de C Valle-6/+6
Fix #115150 by encoding f32 and f64 correctly for cross-language CFI. I missed changing the encoding for f32 and f64 when I introduced the integer normalization option in #105452 as integer normalization does not include floating point. `f32` and `f64` should be always encoded as `f` and `d` since they are both FFI safe when their representation are the same (i.e., IEEE 754) for both the Rust compiler and Clang.
2023-08-23Auto merge of #114790 - taiki-e:asm-maybe-uninit, r=Amanieubors-0/+27
Allow MaybeUninit in input and output of inline assembly **Motivation:** As part of the work to remove UBs from crossbeam's AtomicCell, I'm writing a library to implement atomic operations on MaybeUnint using inline assembly ([atomic-maybe-uninit](https://github.com/taiki-e/atomic-maybe-uninit), https://github.com/crossbeam-rs/crossbeam/pull/1015). However, currently, MaybeUnint cannot be used in input&output of inline assembly, so when processing MaybeUninit, values must be [passed through memory](https://github.com/taiki-e/atomic-maybe-uninit/blob/main/src/arch/aarch64.rs#L121-L122). It is inefficient and microbenchmarks have [actually shown significant performance degradation](https://github.com/crossbeam-rs/crossbeam/pull/1015#issuecomment-1676549870). It would be nice if we could allow MaybeUninit in input and output of inline assembly. --- This PR changed the type check in rustc_hir_analysis to allow `MaybeUnint<int | float | ptr | fn ptr | simd vector>` in input and output of inline assembly and added a simple test. To be honest, I'm not sure that this is the correct way to do it, because this is like doing transmute to integers/floats/etc from MaybeUninit on the compiler side. EDIT: [this seems fine](https://rust-lang.zulipchat.com/#narrow/stream/216763-project-inline-asm/topic/MaybeUninit.20in.20asm!/near/384662900) r? `@Amanieu` cc `@thomcc` (because you [had previously proposed this](https://rust-lang.zulipchat.com/#narrow/stream/216763-project-inline-asm/topic/MaybeUninit.20in.20asm!))
2023-08-23Allow MaybeUninit in input and output of inline assemblyTaiki Endo-0/+27
2023-08-23Rollup merge of #115096 - kadiwa4:no_memcpy_padding, r=cjgillotDylan DPC-0/+14
Add regression test for not `memcpy`ing padding bytes Closes #56297 See this comparison: https://rust.godbolt.org/z/jjzfonfcE I don't have any experience with codegen tests, I hope this is correct
2023-08-22Auto merge of #114643 - dpaoliello:inlinedebuginfo, r=wesleywiserbors-0/+26
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 is 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 when building for x86_64 Windows (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction): ``` .cv_loc 0 1 23 0 # src\lib.rs:23: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, this also requires caching the `DILexicalBlock` and `DIVariable` objects to avoid creating duplicates. After this change the above assembly now looks like: ``` .cv_loc 0 1 23 0 # src\lib.rs:23:0 addq $40, %rsp retq .cv_inline_site_id 5 within 0 inlined_at 1 0 0 .cv_inline_site_id 6 within 5 inlined_at 1 12 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-08-22add regression test for not memcpying padding byteskadiwa-0/+14
2023-08-18tests: Fix tests for LoongArch64WANG Rui-2/+2
2023-08-17Bless codegen tests.Camille GILLOT-16/+16
2023-08-16Auto merge of #114850 - khei4:khei4/trailing_zero_codegen, r=nikicbors-0/+22
add codegen test for `trailing_zeros` comparison This PR add codegen test for https://github.com/rust-lang/rust/issues/107554#issuecomment-1677369236 Fixes #107554.
2023-08-16add codegen test for issue 107554khei4-0/+22
specify llvm-version and bit width for int arg add missing percent simbol
2023-08-15Cherry-pick test for issue #114312DianQK-0/+27