about summary refs log tree commit diff
path: root/tests/codegen
AgeCommit message (Collapse)AuthorLines
2024-07-30Auto merge of #128378 - matthiaskrgr:rollup-i3qz9uo, r=matthiaskrgrbors-0/+55
Rollup of 4 pull requests Successful merges: - #127574 (elaborate unknowable goals) - #128141 (Set branch protection function attributes) - #128315 (Fix vita build of std and forbid unsafe in unsafe in the os/vita module) - #128339 ([rustdoc] Make the buttons remain when code example is clicked) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-30Auto merge of #128250 - Amanieu:select_unpredictable, r=nikicbors-0/+35
Add `select_unpredictable` to force LLVM to use CMOV Since https://reviews.llvm.org/D118118, LLVM will no longer turn CMOVs into branches if it comes from a `select` marked with an `unpredictable` metadata attribute. This PR introduces `core::intrinsics::select_unpredictable` which emits such a `select` and uses it in the implementation of `binary_search_by`.
2024-07-30Rollup merge of #128141 - nikic:aarch64-bti, r=DianQK,cuviperMatthias Krüger-0/+55
Set branch protection function attributes Since LLVM 19, it is necessary to set not only module flags, but also function attributes for branch protection on aarch64. See https://github.com/llvm/llvm-project/commit/e15d67cfc2e5775cc79281aa860f3ad3be628f39 for the relevant LLVM change. Fixes https://github.com/rust-lang/rust/issues/127829.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28Force LLVM to use CMOV for binary searchAmanieu d'Antras-0/+35
Since https://reviews.llvm.org/D118118, LLVM will no longer turn CMOVs into branches if it comes from a `select` marked with an `unpredictable` metadata attribute. This PR introduces `core::intrinsics::select_unpredictable` which emits such a `select` and uses it in the implementation of `binary_search_by`.
2024-07-27Rollup merge of #128262 - DianQK:remove-unused-tests, r=saethlinTrevor Gross-34/+0
Delete `SimplifyArmIdentity` and `SimplifyBranchSame` tests These two passes have already been deleted in #107256. I'm not sure why tidy didn't catch it. As regression tests, I didn't delete `tests/ui/mir/issue-66851.rs` and `tests/ui/mir/simplify-branch-same.rs`. r? compiler
2024-07-27Auto merge of #124905 - reitermarkus:u32-from-char-opt, r=scottmcmbors-0/+35
Allow optimizing `u32::from::<char>`. Extracted from https://github.com/rust-lang/rust/pull/124307. This allows optimizing the panicking branch in the `escape_unicode` function, see https://rust.godbolt.org/z/61YhKrhvP.
2024-07-27Delete `SimplifyArmIdentity` and `SimplifyBranchSame` testsDianQK-34/+0
2024-07-25Let InstCombine remove Clone shims inside Clone shimsBen Kimock-0/+20
Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
2024-07-24Set branch protection function attributesNikita Popov-0/+55
Since LLVM 19, it is necessary to set not only module flags, but also function attributes for branch protection on aarch64. See https://github.com/llvm/llvm-project/commit/e15d67cfc2e5775cc79281aa860f3ad3be628f39 for the relevant LLVM change.
2024-07-21Use `leading_zeros` instead of `ilog2` in tests.Markus Reiter-6/+6
2024-07-21Simplify test.Markus Reiter-6/+8
2024-07-21Add test for cast optimization.Markus Reiter-0/+33
2024-07-21Auto merge of #127715 - klensy:tests-w, r=Mark-Simulacrumbors-5/+0
reenable some windows tests Locally passing on `x86_64-pc-windows-msvc`, fingers crossed for `*-pc-windows-gnu`. try-job: x86_64-msvc try-job: x86_64-mingw
2024-07-15Use Option's discriminant as its size hintScott McMurray-1/+34
2024-07-14reenable some windows testsklensy-5/+0
2024-07-12Auto merge of #123351 - beetrees:x86-ret-snan-rust, r=nikic,workingjubileebors-8/+34
Ensure floats are returned losslessly by the Rust ABI on 32-bit x86 Solves #115567 for the (default) `"Rust"` ABI. When compiling for 32-bit x86, this PR changes the `"Rust"` ABI to return floats indirectly instead of in x87 registers (with the exception of single `f32`s, which this PR returns in general purpose registers as they are small enough to fit in one). No change is made to the `"C"` ABI as that ABI requires x87 register usage and therefore will need a different solution.
2024-07-12Adjust tests for x86 "Rust" ABI changesbeetrees-8/+34
2024-07-02Use the aligned size for alloca at ret when the pass mode is cast.DianQK-11/+11
2024-07-02Use the aligned size for alloca at args when the pass mode is cast.DianQK-28/+11
The `load` and `store` instructions in LLVM access the aligned size.
2024-07-02Add the definition for `extern "C"` at `cast-target-abi.rs`.DianQK-24/+358
2024-06-25Updated code for changes to RFC, added additional error handling, addedFlorian Schmiderer-28/+169
tests
2024-06-25Support `#[patchable_function_entries]`Matthew Maurer-0/+20
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered) TODO before submission: * Needs an RFC * Improve error reporting for malformed attributes
2024-06-25Support for -Z patchable-function-entryMatthew Maurer-0/+8
`-Z patchable-function-entry` works like `-fpatchable-function-entry` on clang/gcc. The arguments are total nop count and function offset. See MCP rust-lang/compiler-team#704
2024-06-25Auto merge of #126852 - scottmcm:more-checked-math-tweaks, r=Amanieubors-0/+14
Also get `add nuw` from `uN::checked_add` When I was doing this for `checked_{sub,shl,shr}`, it was mentioned https://github.com/rust-lang/rust/pull/124114#issuecomment-2066173305 that it'd be worth trying for `checked_add` too. It makes a particularly-big difference for `x.checked_add(C)`, as doing this means that LLVM removes the intrinsic and does it as a normal `x <= MAX - C` instead. cc `@DianQK` who had commented about `checked_add` related to https://github.com/rust-lang/hashbrown/issues/509 before cc https://github.com/llvm/llvm-project/issues/80637 for how LLVM is unlikely to do this itself
2024-06-23Also get `add nuw` from `uN::checked_add`Scott McMurray-0/+14
2024-06-23test: ignore force-frame-pointers test on some targetsJubilee Young-0/+7
all of these currently force stronger frame pointers, and currently the CLI does not override the target
2024-06-23test: for frame-pointer=non-leaf codegen optsJubilee Young-2/+7
2024-06-21Auto merge of #126578 - scottmcm:inlining-bonuses-too, r=davidtwcobors-1/+5
Account for things that optimize out in inlining costs This updates the MIR inlining `CostChecker` to have both bonuses and penalties, rather than just penalties. That lets us add bonuses for some things where we want to encourage inlining without risking wrapping into a gigantic cost. For example, `switchInt(const …)` we give an inlining bonus because codegen will actually eliminate the branch (and associated dead blocks) once it's monomorphized, so measuring both sides of the branch gives an unrealistically-high cost to it. Similarly, an `unreachable` terminator gets a small bonus, because whatever branch leads there doesn't actually exist post-codegen.
2024-06-20Auto merge of #116088 - nbdd0121:unwind, r=Amanieu,RalfJungbors-42/+15
Stabilise `c_unwind` Fix #74990 Fix #115285 (that's also where FCP is happening) Marking as draft PR for now due to `compiler_builtins` issues r? `@Amanieu`
2024-06-19Give inlining bonuses to things that optimize outScott McMurray-1/+5
2024-06-19Fix wasm_exceptions testGary Guo-3/+3
2024-06-19update codegen test for `array::repeat`joboet-1/+1
2024-06-19add codegen test for `array::repeat`joboet-0/+15
2024-06-19Fix non-x86 testsGary Guo-1/+1
2024-06-19Remove c_unwind from tests and fix testsGary Guo-38/+11
2024-06-16Apply suggestion.Slanterns-1/+3
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-06-16add codegen test for `Error::provide`Slanterns-0/+48
2024-06-15Auto merge of #122613 - Zalathar:profiler, r=nnethercotebors-7/+8
Don't build a broken/untested profiler runtime on mingw targets Context: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Why.20build.20a.20broken.2Funtested.20profiler.20runtime.20on.20mingw.3F #75872 added `--enable-profiler` to the `x86_64-mingw` job (to cause some additional tests to run), but had to also add `//@ ignore-windows-gnu` to all of the tests that rely on the profiler runtime actually *working*, because it's broken on that target. We can achieve a similar outcome by going through all the `//@ needs-profiler-support` tests that don't actually need to produce/run a binary, and making them use `-Zno-profiler-runtime` instead, so that they can run even in configurations that don't have the profiler runtime available. Then we can remove `--enable-profiler` from `x86_64-mingw`, and still get the same amount of testing. This PR also removes `--enable-profiler` from the mingw dist builds, since it is broken/untested on that target. Those builds have had that flag for a very long time.
2024-06-14Auto merge of #125347 - tesuji:needtests, r=nikicbors-0/+195
Add codegen tests for E-needs-test close #36010 close #68667 close #74938 close #83585 close #93036 close #109328 close #110797 close #111508 close #112509 close #113757 close #120440 close #118392 close #71096 r? nikic
2024-06-14Use `-Zno-profiler-runtime` instead of `//@ needs-profiler-support`Zalathar-7/+8
For PGO/coverage tests that don't need to build or run an actual artifact, we can use `-Zno-profiler-runtime` to run the test even when the profiler runtime is not available.
2024-06-12Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubileebors-9/+12
Rollup of 16 pull requests Successful merges: - #123374 (DOC: Add FFI example for slice::from_raw_parts()) - #124514 (Recommend to never display zero disambiguators when demangling v0 symbols) - #125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking) - #125980 (Nvptx remove direct passmode) - #126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.) - #126210 (docs(core): make more const_ptr doctests assert instead of printing) - #126249 (Simplify `[T; N]::try_map` signature) - #126256 (Add {{target}} substitution to compiletest) - #126263 (Make issue-122805.rs big endian compatible) - #126281 (set_env: State the conclusion upfront) - #126286 (Make `storage-live.rs` robust against rustc internal changes.) - #126287 (Update a cranelift patch file for formatting changes.) - #126301 (Use `tidy` to sort crate attributes for all compiler crates.) - #126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`) - #126310 (Migrate run make prefer rlib) - #126314 (fix RELEASES: we do not support upcasting to auto traits) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-12Require any function with a tait in its signature to actually constrain a ↵Oli Scherer-63/+73
hidden type
2024-06-11Make issue-122805.rs big endian compatibleNikita Popov-9/+12
Instead of not generating the function at all on big endian (which makes the CHECK lines fail), instead use to_le() on big endian, so that we essentially perform a bswap for both endiannesses.
2024-06-11Fix tests for 32 bits targetsLzu Tao-5/+5
2024-06-09Rollup merge of #125963 - workingjubilee:remove-hashes-from-codegen-tests, ↵许杰友 Jieyou Xu (Joe)-6/+6
r=Mark-Simulacrum Remove hard-coded hashes from codegen tests This removes hard-coded hashes from the codegen and assembly tests. These use FileCheck, which supports eliding part of the pattern being matched, including by capturing it as a pattern parameter for later matching-on. This is much more appropriate than asking contributors to engage with deliberately-opaque identifier schemes. In order to reduce the likelihood of error, every hash-coded segment I've touched now expects a certain length. This correctly represents these cases, as our hash outputs have a predetermined amount of entropy attached to them. This is not done for the UI test suite as those are comparatively easy to simply `--bless`, whereas that would be inappropriate for codegen tests. It is also not done for debuginfo tests as those tests do not support such elision in a correct and useful way.
2024-06-09Apply suggestions from code reviewLzu Tao-49/+33
Co-authored-by: Nikita Popov <github@npopov.com>
2024-06-09add codegen test for #36010Lzu Tao-0/+29
2024-06-09add codegen test for #68667Lzu Tao-0/+17
2024-06-09add codegen test for #74938Lzu Tao-0/+15