about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
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-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-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
2023-08-12Add test for method debuginfo declaration.DianQK-0/+26
We've investigated one reason why debugging information often goes wrong at https://reviews.llvm.org/D152095. > LLVM can't handle IR where subprogram definitions are nested within DICompositeType when doing LTO builds, > because there's no good way to cross the CU boundary to insert a nested DISubprogram definition in one CU into a type defined in another CU.
2023-08-11Use the same DISubprogram for each instance of the same inlined function ↵Daniel Paoliello-0/+26
within the caller
2023-08-10Tell LLVM that the negation in `<*const T>::sub` cannot overflowScott McMurray-0/+34
Today it's just `sub` <https://rust.godbolt.org/z/8EzEPnMr5>; with this PR it's `sub nsw`.
2023-08-07Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obkMatthias Krüger-1/+1
stabilize abi_thiscall Closes https://github.com/rust-lang/rust/issues/42202, stabilizing the use of the "thiscall" ABI. FCP was substituted by a poll, and the poll has been accepted.
2023-08-07stabilize abi_thiscallBenedikt Radtke-1/+1
2023-08-07Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillotMatthias Krüger-0/+34
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly As discussed in #113435, this lets the backends be the place that can have the "don't call the function if n == 0" logic, if it's needed for the target. (I didn't actually *add* those checks, though, since as I understood it we didn't actually need them on known targets?) Doing this also let me make it `const` (unstable), which I don't think `extern "C" fn memcmp` can be. cc `@RalfJung` `@Amanieu`
2023-08-07Rollup merge of #114230 - workingjubilee:codegen-tests-that-nest, ↵Matthias Krüger-178/+0
r=Mark-Simulacrum Nest other codegen test topics This PR is like rust-lang/rust#114229 in that it mostly pushes codegen tests around, shoving them into their own directories, but because all of the changes are very simple cleanups I pulled them into a separate PR. The other PR might involve actually evaluating the correctness of the test after changes, but here it is mostly a matter of taste. The only "functional" change is deleting a few tests that... hinge on a version of LLVM that we don't support (as of rust-lang/rust#114148 anyways). I considered a few different ways to group other topics but I feel the question of whether `tests/codegen/{vec,array,slice}` should exist is more subtle than these choices, as it might be better to group such related tests by other topics like bounds check elision, thus I avoided making it.
2023-08-07Rollup merge of #114229 - workingjubilee:nest-sanitizer-dir, r=Mark-SimulacrumMatthias Krüger-54/+54
Nest tests/codegen/sanitizer*.rs tests in sanitizer dir The sanitizer tests are the largest and most meticulously tested set of tests in tests/codegen. That's good! They all clearly belong to a subject and thus could go in a directory, but are not, instead being placed simply in tests/codegen. That's bad! Fix this by placing them in their own directory and renaming them to be less repetitive after that move. A few tests are brittle, and embed their filename in the test's checks. This is acceptable for the ones where it is used only two times, but one test embeds the test's mangled filename in the test *over 50 times*! This may have been one of the things discouraging anyone from moving it, and thus from moving the set. Fortunately, I have some knowledge of Itanium mangling (involuntarily), regex, and the FileCheck syntax. With a capturing variable, FileCheck allows us to now move this test around again without diffing it on ~50 lines, while still guaranteeing that the mangled substring is the same each time. This also clarifies why the substring is repeated a zillion times, instead of being cryptic. They don't call it mangling because the result is pretty and easy to understand, but now it is slightly easier! Yay descriptive variables!
2023-08-06Add a new `compare_bytes` intrinsic instead of calling `memcmp` directlyScott McMurray-0/+34
2023-08-01Auto merge of #105545 - erikdesjardins:ptrclean, r=bjorn3bors-4/+4
cleanup: remove pointee types This can't be merged until the oldest LLVM version we support uses opaque pointers, which will be the case after #114148. (Also note `-Cllvm-args="-opaque-pointers=0"` can technically be used in LLVM 15, though I don't think we should support that configuration.) I initially hoped this would provide some minor perf win, but in https://github.com/rust-lang/rust/pull/105412#issuecomment-1341224450 it had very little impact, so this is only valuable as a cleanup. As a followup, this will enable #96242 to be resolved. r? `@ghost` `@rustbot` label S-blocked
2023-07-29Remove LLVM 14 codegen testsJubilee Young-178/+0
We raised our LLVM minimum to 15, so these tests seem pointless.
2023-07-29tests/codegen/c-variadic* -> cffi/c-variadic*Jubilee Young-0/+0
2023-07-29tests/codegen/ffi-* -> cffi/ffi-*Jubilee Young-0/+0
2023-07-29tests/codegen/naked-* -> naked-fn/naked-*Jubilee Young-0/+0
2023-07-29tests/codegen/*simd*.rs -> simd/*simd*Jubilee Young-0/+0
2023-07-29tests/codegen/*-macos-* -> macos/*Jubilee Young-0/+0
2023-07-29tests/codegen/enum-* -> enum/enum-*Jubilee Young-0/+0
2023-07-29Fix sanitizer tests depending on filenameJubilee Young-54/+54
In the basic case, simply do the string substitution. For one case with many instances, capture the Itanium- mangled filename and assert its reuse instead.