about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/graph
AgeCommit message (Collapse)AuthorLines
2025-01-26Incorporate `iter_nodes` into `graph::DirectedGraph`Zalathar-2/+18
This assumes that the set of valid node IDs is exactly `0..num_nodes`. In practice, we have a lot of graph-algorithm code that already assumes that nodes are densely numbered, by using `num_nodes` to allocate per-node indexed data structures.
2025-01-16coverage: Completely overhaul counter assignment, using node-flow graphsZalathar-0/+10
2025-01-14Add wrapper type `ReversedGraph` for swapping successors/predecessorsZalathar-0/+43
2025-01-11rename `BitSet` to `DenseBitSet`Rémy Rakic-11/+11
This should make it clearer that this bitset is dense, with the advantages and disadvantages that it entails.
2024-10-24Replace an FTP link in comments with an equivalent HTTPS linkZalathar-1/+1
2024-10-22Move `cmp_in_dominator_order` out of graph dominator computationZalathar-22/+1
Dominator-order information is only needed for coverage graphs, and is easy enough to collect by just traversing the graph again. This avoids wasted work when computing graph dominators for any other purpose.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-76/+83
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-1/+1
2024-08-11Use assert_matches around the compilerMichael Goulet-1/+2
2024-07-29Reformat `use` declarations.Nicholas Nethercote-17/+22
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-12Address code review comments on the commentsAmanda Stjerna-1/+4
2024-06-12Revise documentation after @lqd's commentsAmanda Stjerna-8/+4
2024-06-12Remove a few unnecessary constructionsAmanda Stjerna-4/+7
This shaves off ca 6% of the cycles in `start_walk_from()` in my experiments.
2024-06-12Slightly faster version of `find_state`Amanda Stjerna-24/+27
This version shaves off ca 2% of the cycles in my experiments and makes the control flow easier to follow for me and hopefully others, including the compiler. Someone gave me a working profiler and by God I'm using it.
2024-06-12Docstring for for `Annotation`Amanda Stjerna-2/+12
Note that this changes no executing code. The change is 100% in documentation.
2024-06-12Formatting, weird because I just did thatAmanda Stjerna-2/+3
2024-06-12Simplify path compression logicAmanda Stjerna-17/+2
2024-06-12Documentation fixesAmanda Stjerna-8/+7
2024-06-12Extend SCC construction to enable extra functionalityAmanda Stjerna-129/+472
This patch has been extracted from #123720. It specifically enhances `Sccs` to allow tracking arbitrary commutative properties of SCCs, including - reachable values (max/min) - SCC-internal values (max/min) This helps with among other things universe computation: we can now identify SCC universes as a straightforward "find max/min" operation during SCC construction. It's also more or less zero-cost; don't use the new features, don't pay for them. This commit also vastly extends the documentation of the SCCs module, which I had a very hard time following.
2024-05-30Apply x clippy --fix and x fmtr0cky-4/+4
2024-05-08Remove `extern crate tracing`.Nicholas Nethercote-0/+3
`use` is a nicer way of doing things.
2024-04-18Add tests for predecessor-aware `VecGraph` modeMaybe Waffle-0/+33
2024-04-15Add `graph::depth_first_search_as_undirected`Maybe Waffle-0/+26
2024-04-15Make `graph::DepthFirstSearch` accept `G` by valueMaybe Waffle-13/+13
It's required for the next commit. Note that you can still have `G = &H`, since there are implementations of all the graph traits for references.
2024-04-15Add an opt-in to store incoming edges in `VecGraph` + some docsMaybe Waffle-56/+192
2024-04-15Rollup merge of #123934 - WaffleLapkin:graph-mini-refactor, r=fmease许杰友 Jieyou Xu (Joe)-126/+59
`rustc_data_structures::graph` mini refactor Who doesn't love to breathe dust from the ancient times?
2024-04-15Use RPITIT for `Successors` and `Predecessors` traitsMaybe Waffle-30/+8
Now with RPITIT instead of GAT!
2024-04-14Make `depth_first_search` into a standalone functionMaybe Waffle-5/+10
Does not necessarily change much, but we never overwrite it, so I see no reason for it to be in the `Successors` trait. (+we already have a similar `is_cyclic`)
2024-04-14Document `ControlFlowGraph`Maybe Waffle-4/+2
2024-04-14Rename `WithNumEdges` => `NumEdges` and `WithStartNode` => `StartNode`Maybe Waffle-16/+16
2024-04-14Merge `{With,Graph}{Successors,Predecessors}` into `{Successors,Predecessors}`Maybe Waffle-88/+53
Now with GAT!
2024-04-14Merge `WithNumNodes` into DirectedGraphMaybe Waffle-40/+27
2024-04-03rustc_index: Add a `ZERO` constant to index typesVadim Petrochenkov-4/+4
It is commonly used.
2023-12-31Inline dominator check.Camille GILLOT-0/+1
2023-12-10remove redundant importssurechen-1/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-11-28Avoid an unnecessary `by_ref`.Nicholas Nethercote-1/+1
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-10-10Remove unused dominator iteratorTomasz Miąsko-26/+1
2023-10-05Optimize dominators for small path graphsTomasz Miąsko-10/+65
Generalizes the small dominators approach from #107449.
2023-10-05Remove redundant Dominators::start_node fieldTomasz Miąsko-3/+2
2023-10-05Test immediate dominators using public APITomasz Miąsko-24/+21
2023-09-18coverage: Simplify sorting of coverage spans extracted from MIRZalathar-3/+3
Switching to `Ordering::then_with` makes control-flow less complicated, and there is no need to use `partial_cmp` here.
2023-08-28don't use SnapshotVec in Graph implementation, as it looks unused; use Vec ↵klensy-19/+4
instead
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-3/+1
2023-05-24Auto merge of #111673 - cjgillot:dominator-preprocess, r=cjgillot,tmiaskobors-10/+85
Preprocess and cache dominator tree Preprocessing dominators has a very strong effect for https://github.com/rust-lang/rust/pull/111344. That pass checks that assignments dominate their uses repeatedly. Using the unprocessed dominator tree caused a quadratic runtime (number of bbs x depth of the dominator tree). This PR also caches the dominator tree and the pre-processed dominators in the MIR cfg cache. Rebase of https://github.com/rust-lang/rust/pull/107157 cc `@tmiasko`
2023-05-18Revert spurious changes.Camille GILLOT-9/+9
2023-05-17Merge DominatorTree and Dominators.Camille GILLOT-36/+30
2023-05-17Typo.Camille GILLOT-1/+1
2023-05-17Remove outdated comment.Camille GILLOT-2/+0
2023-05-17Preprocess dominator tree to answer queries in O(1)Tomasz Miąsko-22/+105