about summary refs log tree commit diff
path: root/compiler/rustc_index/src
AgeCommit message (Collapse)AuthorLines
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-15Fix small typo in FIXMEMartin Gammelsæter-2/+2
2022-03-07Add comment linking to closed PR for future optimizersMartin Gammelsæter-4/+8
While optimizing these operations proved unfruitful w.r.t. improving compiler performance right now, faster versions might be needed at a later time.
2022-02-24Fix testAaron Hill-1/+5
2022-02-24Convert `newtype_index` to a proc macroAaron Hill-455/+2
The `macro_rules!` implementation was becomng excessively complicated, and difficult to modify. The new proc macro implementation should make it much easier to add new features (e.g. skipping certain `#[derive]`s)
2022-02-23Introduce `ChunkedBitSet` and use it for some dataflow analyses.Nicholas Nethercote-28/+677
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-19Adopt let else in more placesest31-12/+6
2022-02-16Adopt let_else in even more placesest31-5/+1
2022-02-01implement lint for suspicious auto trait implslcnr-0/+6
2022-01-22Make `Decodable` and `Decoder` infallible.Nicholas Nethercote-4/+4
`Decoder` has two impls: - opaque: this impl is already partly infallible, i.e. in some places it currently panics on failure (e.g. if the input is too short, or on a bad `Result` discriminant), and in some places it returns an error (e.g. on a bad `Option` discriminant). The number of places where either happens is surprisingly small, just because the binary representation has very little redundancy and a lot of input reading can occur even on malformed data. - json: this impl is fully fallible, but it's only used (a) for the `.rlink` file production, and there's a `FIXME` comment suggesting it should change to a binary format, and (b) in a few tests in non-fundamental ways. Indeed #85993 is open to remove it entirely. And the top-level places in the compiler that call into decoding just abort on error anyway. So the fallibility is providing little value, and getting rid of it leads to some non-trivial performance improvements. Much of this commit is pretty boring and mechanical. Some notes about a few interesting parts: - The commit removes `Decoder::{Error,error}`. - `InternIteratorElement::intern_with`: the impl for `T` now has the same optimization for small counts that the impl for `Result<T, E>` has, because it's now much hotter. - Decodable impls for SmallVec, LinkedList, VecDeque now all use `collect`, which is nice; the one for `Vec` uses unsafe code, because that gave better perf on some benchmarks.
2022-01-12remove unused FIXMElcnr-4/+0
2021-12-30Introduce IntervalSetMark Rousskov-0/+469
This is a compact, fast storage for variable-sized sets, typically consisting of larger ranges. It is less efficient than a bitset if ranges are both small and the domain size is small, but will still perform acceptably. With enormous domain sizes and large ranges, the interval set performs much better, as it can be much more densely packed in memory than the uncompressed bit set alternative.
2021-12-22Require Ord for rustc_index::SparseBitSet::last_set_inpierwill-3/+8
2021-12-22Remove `PartialOrd` and `Ord` from `LocalDefId`pierwill-2/+2
Implement `Ord`, `PartialOrd` for SpanData
2021-12-18Derive hash for BitSet and BitMatrixTomasz Miąsko-2/+2
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-11-24Auto merge of #90491 - Mark-Simulacrum:push-pred-faster, r=matthewjasperbors-1/+238
Optimize live point computation This refactors the live-point computation to lower per-MIR-instruction costs by operating on a largely per-block level. This doesn't fundamentally change the number of operations necessary, but it greatly improves the practical performance by aggregating bit manipulation into ranges rather than single-bit; this scales much better with larger blocks. On the benchmark provided in #90445, with 100,000 array elements, walltime for a check build is improved from 143 seconds to 15. I consider the tiny losses here acceptable given the many small wins on real world benchmarks and large wins on stress tests. The new code scales much better, but on some subset of inputs the slightly higher constant overheads decrease performance somewhat. Overall though, this is expected to be a big win for pathological cases (as illustrated by the test case motivating this work) and largely not material for non-pathological cases. I consider the new code somewhat easier to follow, too.
2021-11-13Generate documentation in rustc `rustc_index::newtype_index` macropierwill-1/+23
The macro now documents all generated items. Documentation notes possible panics and unsafety.
2021-11-03Optimize live point computationMark Rousskov-1/+238
This is just replicating the previous algorithm, but taking advantage of the bitset structures to optimize into tighter and better optimized loops. Particularly advantageous on enormous MIR blocks, which are relatively rare in practice.
2021-10-23update cfg(bootstrap)Pietro Albini-6/+0
2021-10-15Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, ↵Matthias Krüger-7/+11
r=petrochenkov" The PR had some unforseen perf regressions that are not as easy to find. Revert the PR for now. This reverts commit 6ae8912a3e7d2c4c775024f58a7ba4b1aedc4073, reversing changes made to 86d6d2b7389fe1b339402c1798edae8b695fc9ef.
2021-10-12Use Option::map_or instead of open coding itLingMan-1/+1
2021-10-11Rollup merge of #89643 - cjgillot:overlap, r=matthewjasperMatthias Krüger-0/+6
Fix inherent impl overlap check. The current implementation of the overlap check was slightly buggy, and unified the wrong connected component in the `ids.len() <= 1` case. This became visible in another PR which changed the iteration order of items. r? ``@matthewjasper`` since you reviewed the other PR.
2021-10-11Remove unnecessary variableClemens Wasser-2/+1
2021-10-10Apply clippy suggestionsClemens Wasser-10/+7
2021-10-07Fix inherent impl overlap check.Camille GILLOT-0/+6
2021-10-04Rollup merge of #89508 - jhpratt:stabilize-const_panic, r=joshtriplettJubilee-2/+6
Stabilize `const_panic` Closes #51999 FCP completed in #89006 ```@rustbot``` label +A-const-eval +A-const-fn +T-lang cc ```@oli-obk``` for review (not `r?`'ing as not on lang team)
2021-10-04Stabilize `const_panic`Jacob Pratt-2/+6
2021-10-03Replace Fn impls with RPIT impls in rustc_indexbjorn3-45/+17
This is cleaner and removes an unstable feature usage
2021-10-02Swap out unboxed_closures feature gate for min_specializationbjorn3-1/+1
For some reason unboxed_closures supresses the feature gate for min_specialization when implementing TrustedStep. min_specialization is the true feature that is used.
2021-09-22rustc_index: Add some map-like APIs to `IndexVec`Vadim Petrochenkov-6/+17
2021-08-27Suggested changesWill Crichton-2/+2
2021-08-27Addd missing domain size assertionsWill Crichton-1/+3
2021-08-26FormattingWill Crichton-6/+6
2021-08-26Fix failing testWill Crichton-7/+7
2021-08-26Add comments and unit tests for new SparseBitMatrix methodsWill Crichton-0/+85
2021-08-26Compile failureWill Crichton-1/+1
2021-08-26TypoWill Crichton-2/+2
2021-08-26Add remaining impl for hybrid X denseWill Crichton-21/+51
2021-08-26Compilation failure in testsWill Crichton-6/+6
2021-08-26FormattingWill Crichton-2/+2
2021-08-26Add commentsWill Crichton-0/+12
2021-08-26Fix sparse intersect bug, add more sparse / dense testsWill Crichton-2/+13
2021-08-25Add unit tests for BitSet intersect/subtractWill Crichton-1/+12
2021-08-25Small fixesWill Crichton-3/+6
2021-08-25Add optimized sparse-hybrid / dense-hybrid intersectWill Crichton-6/+21
2021-08-25Remove BitRelations impls for SparseBitSet, add optimizationsWill Crichton-63/+29
2021-08-24Fix HybridBitSet port issueWill Crichton-3/+16
2021-08-24Refactor BitSet relational methods into trait with parameterizedWill Crichton-122/+231
right-hand side
2021-08-23Make SparseBitMatrix::ensure_row public to enable general mutation of rowsWill Crichton-1/+1