Commit Graph

206 Commits

Author SHA1 Message Date
Ralf Jung
d931b031b4 rename FalseEdges -> FalseEdge 2020-06-07 10:12:21 +02:00
Amanieu d'Antras
1e7b246086 Add asm! to MIR 2020-05-18 14:41:31 +01:00
Jonas Schievink
e22cc993fb Visit move out of _0 when visiting return 2020-05-09 16:08:04 +02:00
Nicholas Nethercote
afd8a4e7ec Improve LocalDecl creation.
This commit adds some new `LocalDecl` methods:
- `with_source_info`, a most general constructor.
- `new`, a variant of `with_source_info` which represents the most
  common use case.
- `internal` a modifying method (like the already present `immutable`).

It removes some old `LocalDecl` methods:
- `new_internal` and `new_local`, because they're subsumed by the new
  methods.
- `new_return_place`, because it was identical to `new_temp`.

Finally, it cleans up all the use sites.
2020-05-06 12:15:26 +10:00
bors
0b958790b3 Auto merge of #70820 - spastorino:replace-fragile-erroneous-const-sys, r=oli-obk
Replace fragile erroneous const sys

Closes #67191

r? @oli-obk
2020-04-24 09:14:47 +00:00
marmeladema
bfce24aa67 Modify as_local_hir_id to return a bare HirId 2020-04-23 23:14:07 +01:00
marmeladema
6148db719f Modify as_local_hir_id to accept a LocalDefId instead of a DefId 2020-04-23 23:14:07 +01:00
Santiago Pastorino
c1ed7cc95f
Rename uneval_consts to required_consts 2020-04-23 18:07:36 -03:00
Santiago Pastorino
5313e2e929
Make inlining carry over unevaluated consts 2020-04-23 16:50:17 -03:00
Dylan MacKenzie
8287842eb4 Use Body everywhere 2020-04-22 09:57:43 -07:00
Dylan MacKenzie
64db428967 Don't use * for deref-coercion 2020-04-22 09:57:43 -07:00
Dylan DPC
707004c552
Rollup merge of #70970 - eddyb:trait-vs-impl-mismatch, r=oli-obk
Detect mistyped associated consts in `Instance::resolve`.

*Based on #71049 to prevent redundant/misleading downstream errors.*

Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
2020-04-22 12:18:31 +02:00
ljedrz
3c455fe8e1 MIR: use span instead of NodeId to determine if optimized_mir should be run 2020-04-19 21:14:19 +02:00
Eduard-Mihai Burtescu
289f46a7f5 Detect mistyped associated consts in Instance::resolve. 2020-04-18 18:39:59 +03:00
Matthias Krüger
3837df2992 don't clone types that are copy (clippy::clone_on_copy) 2020-04-16 00:17:38 +02:00
Jonas Schievink
72ae73ae61 Pass the PlaceElem::Index local to visit_local 2020-04-11 01:39:50 +02:00
Santiago Pastorino
890b39381f
Use Place directly, it's Copy even more use cases 2020-03-31 14:45:05 -03:00
Mazdak Farrokhzad
1ccb0b4a02 rustc -> rustc_middle part 3 (rustfmt) 2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
0cb9e36090 rustc -> rustc_middle part 2 2020-03-30 07:16:56 +02:00
Wesley Wiser
61d3be8de7 Use Reveal::All in MIR inliner 2020-03-21 23:08:32 -04:00
Mazdak Farrokhzad
426a4cc930
Rollup merge of #69934 - andjo403:inlinecost, r=wesleywiser
Update the mir inline costs

handle that when mir is lowered to llvm-ir more code is generated.
Landingpads generates 10 llvm-ir instructions
and resume 9 llvm-ir instructions.

r? @wesleywiser
2020-03-21 08:51:12 +01:00
Mazdak Farrokhzad
4392a8b73c use direct imports for rustc::{lint, session}. 2020-03-16 02:52:06 +01:00
Andreas Jonson
afa940b900 Update the mir inline costs
handle that when mir is lowered to llvm-ir more code is generated.
landingpads generates 10 llvm-ir instructions
and resume 9 llvm-ir instructions.
2020-03-11 19:18:22 +01:00
Tomasz Miąsko
b846b42c8d Selectively disable sanitizer instrumentation
Add `no_sanitize` attribute that allows to opt out from sanitizer
instrumentation in an annotated function.
2020-02-05 23:30:38 +01:00
Mazdak Farrokhzad
93a8283614 Move builtin attribute logic to new rustc_attr crate.
For now, this is all the crate contains, but more
attribute logic & types will be moved there over time.
2020-02-01 18:54:56 +01:00
Santiago Pastorino
10b19f6dee
make_integrate_local takes Local by value 2020-01-28 10:12:53 -03:00
Matthias Krüger
ec61761e46 don't clone types that are copy, round two. 2020-01-27 01:18:18 +01:00
Santiago Pastorino
5d9b399044 Remove PlaceBase enum and make Place base field be local: Local 2020-01-10 09:08:25 +01:00
Santiago Pastorino
fd5aa32c35 Remove Static from PlaceBase 2020-01-10 09:08:24 +01:00
Mazdak Farrokhzad
ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad
66f5bf1b8b extract rustc::middle::codegen_fn_attrs 2020-01-04 18:43:06 +01:00
Aaron Hill
e8e53b56df
Ensure that we process projections during MIR inlining
Fixes #67710

Previously, we were not calling `super_place`, which resulted in us
failing to update any local references that occur in
ProjectionElem::Index. This caused the post-inlining MIR to contain a
reference to a local ID from the inlined callee, leading to an ICE
due to a type mismatch.
2020-01-01 20:10:55 -05:00
Wesley Wiser
25a8b5d58e Fix Instance::resolve() incorrectly returning specialized instances
We only want to return specializations when `Reveal::All` is passed, not
when `Reveal::UserFacing` is. Resolving this fixes several issues with
the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization
passes.

Fixes #66901
2019-12-27 13:04:32 -05:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Wesley Wiser
bec4fc175a [mir-opt] Fix Inline pass to handle inlining into box expressions 2019-12-20 20:39:47 -05:00
Mazdak Farrokhzad
56c0bea390
Rollup merge of #66991 - Nashenas88:body_cache_cleanup, r=eddyb
Cleanup BodyCache

After this PR:

- `BodyCache` is renamed to `BodyAndCache`
- `ReadOnlyBodyCache` is renamed to `ReadOnlyBodyAndCache`
- `ReadOnlyBodyAndCache::body` fn is removed and all calls to it are replaced by a deref (possible due to fix of its `Deref` imp in #65947)

cc @eddyb @oli-obk
2019-12-08 03:39:45 +01:00
Adam Perry
cc574be985 #[track_caller] suppresses MIR inlining. 2019-12-05 21:12:34 -08:00
Paul Daniel Faria
756aa1e46c rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded Index impl, remove body fn
rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence
rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-05 22:58:41 -05:00
Paul Daniel Faria
b2fe254c98 Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, rename all body_cache back to body 2019-12-02 08:40:56 -05:00
Paul Daniel Faria
595d161d36 Remove BodyCache.body and rely on Deref as much as possible for ReadOnlyBodyCache 2019-12-02 08:38:16 -05:00
Paul Daniel Faria
67b7a78231 Fix tidy errors 2019-12-02 08:38:16 -05:00
Paul Daniel Faria
4de31b26d1 Fix remaining compilation issues 2019-12-02 08:37:04 -05:00
Paul Daniel Faria
fc6b58d0a8 Simplify BodyCache impl and fix all remaining type errors in librustc_mir (lifetime errors still exist) 2019-12-02 08:35:08 -05:00
Paul Daniel Faria
52cc85f008 Address nits and remove unneeded pass 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
ad734680af Move predecessors cache invalidation back to basic_blocks_mut, add a couple more ensure_predecessors to prevent panics 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
f534d9f8c4 Stop invalidating predecessors cache when accessing unique basic block, invalidate cache when accessing unique terminator 2019-12-02 08:30:30 -05:00
Eduard-Mihai Burtescu
a9976d89ed rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. 2019-11-30 01:37:42 +02:00
Eduard-Mihai Burtescu
78d85fcf52 rustc_mir: fix inliner to also copy over source_scope_local_data. 2019-11-30 01:36:51 +02:00
Eduard-Mihai Burtescu
563ed27c01 rustc: move debug info from LocalDecl and UpvarDecl into a dedicated VarDebugInfo. 2019-11-27 19:22:03 +02:00
Santiago Pastorino
180fc413fb
Move Place::elem methods and friends to TyCtxt 2019-10-22 10:33:36 -03:00