rust/tests
bors 3b022d8cee Auto merge of #133852 - x17jiri:cold_path, r=saethlin
improve cold_path()

#120370 added a new instrinsic `cold_path()` and used it to fix `likely` and `unlikely`

However, in order to limit scope, the information about cold code paths is only used in 2-target switch instructions. This is sufficient for `likely` and `unlikely`, but limits usefulness of `cold_path` for idiomatic rust. For example, code like this:

```
if let Some(x) = y { ... }
```

may generate 3-target switch:

```
switch y.discriminator:
0 => true branch
1 = > false branch
_ => unreachable
```

and therefore marking a branch as cold will have no effect.

This PR improves `cold_path()` to work with arbitrary switch instructions.

Note that for 2-target switches, we can use `llvm.expect`, but for multiple targets we need to manually emit branch weights. I checked Clang and it also emits weights in this situation. The Clang's weight calculation is more complex that this PR, which I believe is mainly because `switch` in `C/C++` can have multiple cases going to the same target.
2025-02-18 07:49:09 +00:00
..
assembly use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
auxiliary use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
codegen Auto merge of #133852 - x17jiri:cold_path, r=saethlin 2025-02-18 07:49:09 +00:00
codegen-units Remove -Zinline-in-all-cgus and clean up CGU partitioning tests 2025-01-27 23:48:47 -05:00
coverage coverage: Eliminate more counters by giving them to unreachable nodes 2025-02-13 13:45:53 +11:00
coverage-run-rustdoc
crashes adjust derive_error 2025-02-13 23:49:09 +01:00
debuginfo Revert "Remove the Arc rt::init allocation for thread info" 2025-01-14 13:37:25 +01:00
incremental tests: error strings for ABI stability now match 2025-02-09 20:45:47 -08:00
mir-opt Don't project into NonNull when dropping a Box 2025-02-15 23:20:52 -08:00
pretty
run-make Rollup merge of #137095 - saethlin:use-hash64-for-hashes, r=workingjubilee 2025-02-17 06:38:14 +01:00
rustdoc Add regression test for source line numbers 2025-02-11 14:29:58 +01:00
rustdoc-gui rustdoc: use better, consistent SVG icons for scraped examples 2025-02-12 16:07:11 -07:00
rustdoc-js Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez 2024-12-16 20:00:20 +01:00
rustdoc-js-std Remove the common prelude module 2025-02-11 13:04:27 -08:00
rustdoc-json Add missing lang items in no_core tests in rustdoc 2025-02-04 01:05:31 +00:00
rustdoc-ui Rollup merge of #137120 - ChrisDenton:its-all-relative, r=GuillaumeGomez 2025-02-17 06:38:15 +01:00
ui Auto merge of #137164 - matthiaskrgr:rollup-dj5826k, r=matthiaskrgr 2025-02-17 11:18:33 +00:00
ui-fulldeps Auto merge of #137164 - matthiaskrgr:rollup-dj5826k, r=matthiaskrgr 2025-02-17 11:18:33 +00:00
COMPILER_TESTS.md