Skip to content

Commit 621e94b

Browse files
Auto merge of #113382 - lqd:test-mcp510, r=<try>
[perf] test MCP510
2 parents d5525a7 + 4fb2d00 commit 621e94b

File tree

8 files changed

+939
-276
lines changed

8 files changed

+939
-276
lines changed

compiler/rustc_borrowck/src/nll.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,15 @@ pub(crate) fn compute_regions<'tcx>(
154154
// If requested for `-Zpolonius=next`, convert NLL constraints to localized outlives constraints
155155
// and use them to compute loan liveness.
156156
let polonius_diagnostics = polonius_context.map(|polonius_context| {
157-
polonius_context.compute_loan_liveness(infcx.tcx, &mut regioncx, body, borrow_set)
157+
// let _timer = std::time::Instant::now();
158+
let ret =
159+
polonius_context.compute_loan_liveness(infcx.tcx, &mut regioncx, body, borrow_set);
160+
// eprintln!(
161+
// "compute_loan_liveness took: {} ns, {:?}, borrows: {}, localized constraints: {}",
162+
// _timer.elapsed().as_nanos(),
163+
// body.span, borrow_set.len(), ret.localized_outlives_constraints.outlives.len(),
164+
// );
165+
ret
158166
});
159167

160168
// If requested: dump NLL facts, and run legacy polonius analysis.

compiler/rustc_borrowck/src/polonius/constraints.rs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use rustc_middle::ty::RegionVid;
22
use rustc_mir_dataflow::points::PointIndex;
33

4+
use crate::region_infer::values::LivenessValues;
5+
46
/// A localized outlives constraint reifies the CFG location where the outlives constraint holds,
57
/// within the origins themselves as if they were different from point to point: from `a: b`
68
/// outlives constraints to `a@p: b@p`, where `p` is the point in the CFG.
@@ -23,6 +25,25 @@ pub(crate) struct LocalizedOutlivesConstraint {
2325
pub from: PointIndex,
2426
pub target: RegionVid,
2527
pub to: PointIndex,
28+
pub tag: &'static str,
29+
}
30+
31+
impl rustc_mir_dataflow::fmt::DebugWithContext<LivenessValues> for LocalizedOutlivesConstraint {
32+
fn fmt_with(
33+
&self,
34+
liveness: &LivenessValues,
35+
fmt: &mut std::fmt::Formatter<'_>,
36+
) -> std::fmt::Result {
37+
write!(
38+
fmt,
39+
"{}@{:?} -> {}@{:?} ({})",
40+
self.source.as_u32(),
41+
liveness.location_from_point(self.from),
42+
self.target.as_u32(),
43+
liveness.location_from_point(self.to),
44+
self.tag,
45+
)
46+
}
2647
}
2748

2849
/// A container of [LocalizedOutlivesConstraint]s that can be turned into a traversable
@@ -33,11 +54,11 @@ pub(crate) struct LocalizedOutlivesConstraintSet {
3354
}
3455

3556
impl LocalizedOutlivesConstraintSet {
36-
pub(crate) fn push(&mut self, constraint: LocalizedOutlivesConstraint) {
37-
if constraint.source == constraint.target && constraint.from == constraint.to {
38-
// 'a@p: 'a@p is pretty uninteresting
39-
return;
40-
}
41-
self.outlives.push(constraint);
42-
}
57+
// pub(crate) fn push(&mut self, constraint: LocalizedOutlivesConstraint) {
58+
// if constraint.source == constraint.target && constraint.from == constraint.to {
59+
// // 'a@p: 'a@p is pretty uninteresting
60+
// return;
61+
// }
62+
// self.outlives.push(constraint);
63+
// }
4364
}

compiler/rustc_borrowck/src/polonius/dump.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ fn emit_polonius_mir<'tcx>(
216216
writeln!(out, "| Localized constraints")?;
217217

218218
for constraint in &localized_outlives_constraints.outlives {
219-
let LocalizedOutlivesConstraint { source, from, target, to } = constraint;
219+
let LocalizedOutlivesConstraint { source, from, target, to, .. } = constraint;
220220
let from = liveness.location_from_point(*from);
221221
let to = liveness.location_from_point(*to);
222222
writeln!(out, "| {source:?} at {from:?} -> {target:?} at {to:?}")?;

0 commit comments

Comments
 (0)