Commit Graph

672 Commits

Author SHA1 Message Date
bors
3942254d00 Auto merge of #124905 - reitermarkus:u32-from-char-opt, r=scottmcm
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-27 09:34:26 +00:00
Ben Kimock
a7d57aa7c8 Let InstCombine remove Clone shims inside Clone shims
Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
2024-07-25 15:14:42 -04:00
Markus Reiter
2f2eb22b73
Use leading_zeros instead of ilog2 in tests. 2024-07-21 18:21:33 +02:00
Markus Reiter
45b87fb401
Simplify test. 2024-07-21 18:21:33 +02:00
Markus Reiter
64fb903c95
Add test for cast optimization. 2024-07-21 18:21:33 +02:00
bors
a62ac152ad Auto merge of #127715 - klensy:tests-w, r=Mark-Simulacrum
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-21 03:06:32 +00:00
Scott McMurray
eb3cc5f824 Use Option's discriminant as its size hint 2024-07-15 00:34:03 -07:00
klensy
b90ee2a51a reenable some windows tests 2024-07-14 13:48:29 +03:00
bors
c6727fc9b5 Auto merge of #123351 - beetrees:x86-ret-snan-rust, r=nikic,workingjubilee
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-12 20:36:43 +00:00
beetrees
cae9d480bf
Adjust tests for x86 "Rust" ABI changes 2024-07-12 10:47:56 +01:00
DianQK
2ef82805d5
Use the aligned size for alloca at ret when the pass mode is cast. 2024-07-02 06:33:40 +08:00
DianQK
c453dcd62a
Use the aligned size for alloca at args when the pass mode is cast.
The `load` and `store` instructions in LLVM access the aligned size.
2024-07-02 06:33:35 +08:00
DianQK
09e0abb0d1
Add the definition for extern "C" at cast-target-abi.rs. 2024-07-02 06:31:35 +08:00
Florian Schmiderer
7c56398e91 Updated code for changes to RFC, added additional error handling, added
tests
2024-06-25 19:00:02 +02:00
Matthew Maurer
9b0ae75ecc Support #[patchable_function_entries]
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-25 18:23:41 +02:00
Matthew Maurer
ac7595fdb1 Support for -Z patchable-function-entry
`-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-25 18:21:42 +02:00
bors
fc555cd832 Auto merge of #126852 - scottmcm:more-checked-math-tweaks, r=Amanieu
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-25 02:50:37 +00:00
Scott McMurray
ec9e35618d Also get add nuw from uN::checked_add 2024-06-23 13:29:06 -07:00
Jubilee Young
c72a6ad8f2 test: ignore force-frame-pointers test on some targets
all of these currently force stronger frame pointers, and
currently the CLI does not override the target
2024-06-23 00:40:43 -07:00
Jubilee Young
f301d087d4 test: for frame-pointer=non-leaf codegen opts 2024-06-23 00:36:33 -07:00
bors
7a08f84627 Auto merge of #126578 - scottmcm:inlining-bonuses-too, r=davidtwco
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-21 02:06:27 +00:00
bors
1aaab8b9f8 Auto merge of #116088 - nbdd0121:unwind, r=Amanieu,RalfJung
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-20 11:22:59 +00:00
Scott McMurray
4236da52af Give inlining bonuses to things that optimize out 2024-06-19 21:35:37 -07:00
Gary Guo
bb2716effd Fix wasm_exceptions test 2024-06-19 21:26:48 +01:00
joboet
0aa3310a9a
update codegen test for array::repeat 2024-06-19 17:48:05 +02:00
joboet
1a8b0d7c53
add codegen test for array::repeat 2024-06-19 17:29:54 +02:00
Gary Guo
4c4d62d74f Fix non-x86 tests 2024-06-19 13:54:56 +01:00
Gary Guo
5812b1fd12 Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
Slanterns
51d9546416
Apply suggestion.
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-06-16 17:19:25 +08:00
Slanterns
240478383b
add codegen test for Error::provide 2024-06-16 07:43:08 +08:00
bors
3fc81daffd Auto merge of #122613 - Zalathar:profiler, r=nnethercote
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-15 00:04:01 +00:00
bors
7ac6c2fc68 Auto merge of #125347 - tesuji:needtests, r=nikic
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-14 13:40:52 +00:00
Zalathar
5330ccdb34 Use -Zno-profiler-runtime instead of //@ needs-profiler-support
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-14 13:31:46 +10:00
bors
bbe9a9c20b Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubilee
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-12 11:10:50 +00:00
Oli Scherer
0bc2001879 Require any function with a tait in its signature to actually constrain a hidden type 2024-06-12 08:53:59 +00:00
Nikita Popov
26fa5c2c30 Make issue-122805.rs big endian compatible
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-11 16:07:14 +02:00
Lzu Tao
ab0f87ec66 Fix tests for 32 bits targets 2024-06-11 07:45:16 +00:00
许杰友 Jieyou Xu (Joe)
3720757d21
Rollup merge of #125963 - workingjubilee:remove-hashes-from-codegen-tests, 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-09 19:16:21 +01:00
Lzu Tao
f9edd864df Apply suggestions from code review
Co-authored-by: Nikita Popov <github@npopov.com>
2024-06-09 13:25:12 +00:00
Lzu Tao
95740fbfed add codegen test for #36010 2024-06-09 07:35:24 +00:00
Lzu Tao
5f527eb562 add codegen test for #68667 2024-06-09 07:35:24 +00:00
Lzu Tao
bf178187c7 add codegen test for #74938 2024-06-09 07:35:24 +00:00
Lzu Tao
8bd6c04cfc add codegen test for #93036 2024-06-09 07:35:24 +00:00
Lzu Tao
7d967ffa8d add codegen test for #109328 2024-06-09 07:35:24 +00:00
Lzu Tao
ddb94dbd16 add codegen test for #110797 2024-06-09 07:35:24 +00:00
Lzu Tao
15d07fb2cb Add codegen test for #111508 2024-06-09 07:35:24 +00:00
Lzu Tao
beabc5647b add codegen test for #112509 2024-06-09 07:35:24 +00:00
Lzu Tao
f37c576dbd add codegen test for #113757 2024-06-09 07:35:24 +00:00
Lzu Tao
f3c89f1751 add codegen test for issue-118392, 71096 2024-06-09 07:35:24 +00:00
Lzu Tao
36e1414b10 add codegen test for #120440 2024-06-09 07:35:23 +00:00