Skip to content

Commit 9b2331d

Browse files
committed
Rollup merge of rust-lang#57027 - Zoxc:query-perf5, r=michaelwoerister
Optimize away a move r? @michaelwoerister
2 parents 4446c65 + edd08e0 commit 9b2331d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/librustc/ty/query/plumbing.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,14 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
136136
Entry::Vacant(entry) => {
137137
// No job entry for this query. Return a new one to be started later
138138
return tls::with_related_context(tcx, |icx| {
139+
// Create the `parent` variable before `info`. This allows LLVM
140+
// to elide the move of `info`
141+
let parent = icx.query.clone();
139142
let info = QueryInfo {
140143
span,
141144
query: Q::query(key.clone()),
142145
};
143-
let job = Lrc::new(QueryJob::new(info, icx.query.clone()));
146+
let job = Lrc::new(QueryJob::new(info, parent));
144147
let owner = JobOwner {
145148
cache,
146149
job: job.clone(),

0 commit comments

Comments
 (0)