Skip to content

Commit

Permalink
Rollup merge of rust-lang#57027 - Zoxc:query-perf5, r=michaelwoerister
Browse files Browse the repository at this point in the history
Optimize away a move

r? @michaelwoerister
  • Loading branch information
Centril authored Dec 22, 2018
2 parents 9ef6127 + edd08e0 commit f9eddb9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,14 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
Entry::Vacant(entry) => {
// No job entry for this query. Return a new one to be started later
return tls::with_related_context(tcx, |icx| {
// Create the `parent` variable before `info`. This allows LLVM
// to elide the move of `info`
let parent = icx.query.clone();
let info = QueryInfo {
span,
query: Q::query(key.clone()),
};
let job = Lrc::new(QueryJob::new(info, icx.query.clone()));
let job = Lrc::new(QueryJob::new(info, parent));
let owner = JobOwner {
cache,
job: job.clone(),
Expand Down

0 comments on commit f9eddb9

Please sign in to comment.