Commit Graph

37 Commits

Author SHA1 Message Date
Tomasz Miąsko 357c3cf72c Fix handling of dead unwinds in backward analyses
Dead unwinds set contains a head of an unreachable unwind edge.
2023-01-02 22:24:01 +01:00
Matthias Krüger 2daa3bcbc2 Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-dead
compiler: remove unnecessary imports and qualified paths

Some of these imports were necessary before Edition 2021, others were already in the prelude.

I hope it's fine that this PR is so spread-out across files :/
2022-12-11 09:51:57 +01:00
KaDiWa 9bc69925cb compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
Jakob Degen 9fb8da8f8f Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
Oli Scherer 4f593ce5d8 Create format_args as late as possible 2022-12-01 08:49:51 +00:00
Jannis Christopher Köhl 1f82a9f89e Move HasTop and HasBottom into lattice.rs 2022-11-07 10:35:25 +01:00
Jannis Christopher Köhl 4f9c30fb67 Add initial version of value analysis and dataflow constant propagation 2022-11-07 10:35:08 +01:00
Matthias Krüger d182081de1 Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk
Replace `Body::basic_blocks()` with field access

Since the refactoring in #98930, it is possible to borrow the basic blocks
independently from other parts of MIR by accessing the `basic_blocks` field
directly.

Replace unnecessary `Body::basic_blocks()` method with a direct field access,
which has an additional benefit of borrowing the basic blocks only.
2022-08-29 06:34:43 +02:00
Tomasz Miąsko b48870b451 Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
5225225 ee2b16100e Migrate rustc_mir_dataflow to diagnostic structs 2022-08-23 11:24:51 +01:00
SparrowLii d39fefdd69 use type alias impl trait in outlives_bounds::InferCtxtExt 2022-08-22 18:10:28 +08:00
Joshua Nelson 3c9765cff1 Rename debugging_opts to unstable_opts
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.
2022-07-13 17:47:06 -05:00
Dylan DPC 6910d84bc4 Rollup merge of #98981 - pierwill:pierwill/dataflow-docs-edits, r=Dylan-DPC
Edit `rustc_mir_dataflow::framework` documentation

Some edits for clarity and consistency.
2022-07-07 18:06:55 +05:30
Tomasz Miąsko dfa6a7cbde Move switch_sources from Body to BasicBlocks 2022-07-07 08:11:49 +02:00
Tomasz Miąsko 39d9c1cb1f Move predecessors from Body to BasicBlocks 2022-07-07 08:11:49 +02:00
Tomasz Miąsko 2446b17745 Move is_cfg_cyclic from Body to BasicBlocks 2022-07-07 08:11:49 +02:00
pierwill 8c9a130056 Edit rustc_mir_dataflow::framework documentation 2022-07-06 11:20:40 -05:00
pierwill f8b16c5d87 Edit rustc_mir_dataflow::framework::lattice::FlatSet docs
Cosmetic improvements. Adds a paragraph break, and
ellipses to signify arbitrary size of a flat set.
2022-07-05 11:34:39 -05:00
Maybe Waffle c1a2db3372 Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
Tomasz Miąsko 39de03d844 Change Direction::{is_forward,is_backward} functions into constants
Make it explicit that the analysis direction is constant.

This also makes the value immediately available for optimizations.
Previously those functions were neither inline nor generic and so their
definition was unavailable when using data flow framework from other
crates.
2022-06-07 17:02:55 +02:00
Jakob Degen 09b0936db2 Refactor call terminator to always hold a destination place 2022-05-23 17:49:04 -04:00
Michael Goulet 1784634a39 Lifetime variance fixes for rustc 2022-05-22 14:29:32 -07:00
SparrowLii 38bf1158bd Change Successors to impl Iterator<Item = BasicBlock> 2022-05-17 08:41:01 +08:00
lcnr 6c8265dc56 only_local: always check for misuse 2022-05-10 12:07:35 +02:00
Tomasz Miąsko 2be012a0c6 Use sparse representation of switch sources
to avoid quadratic space overhead
2022-05-08 23:48:23 +02:00
Tomasz Miąsko fbc3cc18be Avoid constructing switch sources unless necessary
Switch sources are used by backward analysis with a custom switch int
edge effects, but are otherwise unnecessarily computed.

Delay the computation until we know that switch sources are indeed
required and avoid the computation otherwise.
2022-05-08 23:14:56 +02:00
Tomasz Miąsko 0e7d54c9e7 Fix -Zdump-mir-dataflow by implementing DebugWithContext for ChunkedBitSet 2022-04-30 16:40:54 +02:00
Dylan MacKenzie 241ec5b3b3 Nit 2022-03-27 10:58:55 -07:00
Samuel E. Moelius III 37ebd47ddb Address review comments
* Add lazily computed `switch_sources` data structure
* Don't assume a target has only one associated value
2022-03-26 08:01:51 -04:00
Samuel E. Moelius III ee7413b94c Implement apply_switch_int_edge_effects for backward analyses 2022-03-24 20:08:45 -04:00
Nicholas Nethercote 36b495f3cf Introduce ChunkedBitSet and use it for some dataflow analyses.
This reduces peak memory usage significantly for some programs with very
large functions, such as:
- `keccak`, `unicode_normalization`, and `match-stress-enum`, from
  the `rustc-perf` benchmark suite;
- `http-0.2.6` from crates.io.

The new type is used in the analyses where the bitsets can get huge
(e.g. 10s of thousands of bits): `MaybeInitializedPlaces`,
`MaybeUninitializedPlaces`, and `EverInitializedPlaces`.

Some refactoring was required in `rustc_mir_dataflow`. All existing
analysis domains are either `BitSet` or a trivial wrapper around
`BitSet`, and access in a few places is done via `Borrow<BitSet>` or
`BorrowMut<BitSet>`. Now that some of these domains are `ClusterBitSet`,
that no longer works. So this commit replaces the `Borrow`/`BorrowMut`
usage with a new trait `BitSetExt` containing the needed bitset
operations. The impls just forward these to the underlying bitset type.
This required fiddling with trait bounds in a few places.

The commit also:
- Moves `static_assert_size` from `rustc_data_structures` to
  `rustc_index` so it can be used in the latter; the former now
  re-exports it so existing users are unaffected.
- Factors out some common "clear excess bits in the final word"
  functionality in `bit_set.rs`.
- Uses `fill` in a few places instead of loops.
2022-02-23 10:18:49 +11:00
est31 2ef8af6619 Adopt let else in more places 2022-02-19 17:27:43 +01:00
LegionMammal978 fed881aafc Remove in_band_lifetimes from rustc_mir_dataflow
See #91867 for more information.
2021-12-16 14:29:43 -05:00
Amanieu d'Antras 940b2eabad Add initial AST and MIR support for unwinding from inline assembly 2021-12-03 23:51:46 +01:00
Dylan MacKenzie abd3fe347b Ignore errors re: unreachable blocks in dataflow cursor unit tests 2021-10-23 21:55:57 -04:00
Camille GILLOT c5fc2609f0 Rename rustc_mir to rustc_const_eval. 2021-09-07 20:46:26 +02:00
Camille GILLOT fd9c04fe32 Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00