diff options
| author | bors <bors@rust-lang.org> | 2024-06-30 11:09:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-30 11:09:53 +0000 |
| commit | 2975a21b5d6e4718cf219349d3cb37d45c20f84d (patch) | |
| tree | 73f9c1b8471352b9beafd0c83eb3fa762c0f66f5 /compiler/rustc_mir_dataflow | |
| parent | 716752ebe6974b5c6ab9b34b894e075f3e4a4b1e (diff) | |
| parent | c81481fdb91cca96635017e7275139b0f2cd8fe6 (diff) | |
| download | rust-2975a21b5d6e4718cf219349d3cb37d45c20f84d.tar.gz rust-2975a21b5d6e4718cf219349d3cb37d45c20f84d.zip | |
Auto merge of #127024 - cjgillot:jump-prof, r=oli-obk
Avoid cloning jump threading state when possible The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator. This is not optimal, but a first step while I refactor the state data structure to be sparse. The two other commits are drive-by. Fixes https://github.com/rust-lang/rust/issues/116721 r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_mir_dataflow')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/value_analysis.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index 5e2d88f94ca..bfbfff7e259 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -846,9 +846,10 @@ impl Map { if let ty::Ref(_, ref_ty, _) | ty::RawPtr(ref_ty, _) = ty.kind() && let ty::Slice(..) = ref_ty.kind() + // The user may have written a predicate like `[T]: Sized` in their where clauses, + // which makes slices scalars. + && self.places[place].value_index.is_none() { - assert!(self.places[place].value_index.is_none(), "slices are not scalars"); - // Prepend new child to the linked list. let len = self.places.push(PlaceInfo::new(Some(TrackElem::DerefLen))); self.places[len].next_sibling = self.places[place].first_child; |
