diff options
| author | kennytm <kennytm@gmail.com> | 2018-12-23 00:07:56 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-12-23 02:12:19 +0800 |
| commit | 9b2331d2ca3c5348922211f309198af465fa23ff (patch) | |
| tree | 87119f597e5634c4f06325b8e8c5f92d07f72cb5 | |
| parent | 4446c65d9b6971ec80684ef5c299ab56cb1d16d8 (diff) | |
| parent | edd08e020cb1269a0f171e0502d8bc166c78e58b (diff) | |
| download | rust-9b2331d2ca3c5348922211f309198af465fa23ff.tar.gz rust-9b2331d2ca3c5348922211f309198af465fa23ff.zip | |
Rollup merge of #57027 - Zoxc:query-perf5, r=michaelwoerister
Optimize away a move r? @michaelwoerister
| -rw-r--r-- | src/librustc/ty/query/plumbing.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index a73b92ed713..3f90f072ddb 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -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(), |
