summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2017-05-24box large variants in MIRAriel Ben-Yehuda-12/+12
Operand: 72 -> 24 B Statement: 192 -> 96 B Terminator: 256 -> 112 B librustc translation memory usage: 1795 -> 1669 MB next step would be interning lvalues, I suppose?
2017-04-22avoid calling `mk_region` unnecessarilyAriel Ben-Yehuda-4/+4
this improves typeck & trans performance by 1%. This looked hotter on callgrind than it is on a CPU.
2017-04-22remove cleanup branches to the resume blockAriel Ben-Yehuda-0/+34
This improves LLVM performance by 10% lost during the shimmir transition.
2017-04-20rustc: combine type_needs_drop_given_env and may_drop into needs_drop.Eduard-Mihai Burtescu-2/+2
2017-04-20rustc: replace interior_unsafe with a Freeze trait.Eduard-Mihai Burtescu-1/+1
2017-04-12address review commentsAriel Ben-Yehuda-0/+4
2017-04-11Move rvalue checking to MIRAriel Ben-Yehuda-4/+44
Fixes #41139.
2017-04-11store Spans for all MIR localsAriel Ben-Yehuda-12/+11
2017-04-07Changes based on PR feedbackRyan Scott-7/+2
2017-04-04Fixed ICEs with pattern matching in const fn. Fixes #38199, fixes #31577, ↵Ryan Scott-4/+2
fixes #29093, and fixes #40012.
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-2/+2
2017-03-24Represent function pointers in mir-constants as a Value instead of ItemOliver Schneider-6/+4
2017-03-22Rollup merge of #40678 - michaelwoerister:dmi-prep, r=nikomatsakisCorey Farwell-1/+27
Some preparations for directly computing the ICH of crate-metadata. This PR contains some small fixes in preparation for direct metadata hashing. It mostly just moves stuff into places where it will be needed (making the module structure slightly cleaner along the way) and it fixes some omissions in the MIR region eraser. r? @nikomatsakis
2017-03-22Address review comments.Michael Woerister-2/+11
2017-03-22Add some missing method impls to MIR region eraser.Michael Woerister-1/+18
2017-03-21Teach rustc --emit=mirJake Goulding-0/+14
2017-03-18apply pre-trans passes to Shim MIRAriel Ben-Yehuda-40/+52
2017-03-18move the drop expansion code to rustc_mirAriel Ben-Yehuda-3/+3
2017-03-10Only run inlining if mir opts are enabledJames Miller-1/+1
2017-03-10Add dep-graph tasks where neededJames Miller-16/+10
2017-03-10Initial implementation of inlining for MIRJames Miller-3/+858
Fairly basic implementation of inlining for MIR. Uses conservative heuristics for inlining.
2017-03-04Auto merge of #40163 - arielb1:normalization-1702, r=nikomatsakisbors-10/+19
More through normalization, Feb/Mar 2017 edition Fix a few normalization bugs. Fixes #27901. Fixes #28828. Fixes #38135. Fixes #39363. Fixes #39367.
2017-03-01transform broken MIR warnings to hard ICEsAriel Ben-Yehuda-8/+7
We ought to do that sometime, and this PR fixes all broken MIR errors I could find.
2017-03-01store the normalized types of statics in MIR LvaluesAriel Ben-Yehuda-2/+12
The types of statics, like all other items, are stored in the tcx unnormalized. This is necessarily so, because a) Item types other than statics have generics, which can't be normalized. b) Eager normalization causes undesirable on-demand dependencies. Keeping with the principle that MIR lvalues require no normalization in order to interpret, this patch stores the normalized type of the statics in the Lvalue and reads it to get the lvalue type. Fixes #39367.
2017-02-28Make Rvalue::ty infallibleSimonas Kazlauskas-11/+6
2017-02-25rustc_const_eval: demand that the MIR qualify_consts ran on each evaluated body.Eduard-Mihai Burtescu-76/+71
2017-02-25rustc_typeck: rework coherence to be almost completely on-demand.Eduard-Mihai Burtescu-3/+3
2017-02-25rustc: combine BareFnTy and ClosureTy into FnSig.Eduard-Mihai Burtescu-4/+4
2017-02-23Implement non-capturing closure to fn coercionest31-0/+1
2017-02-15[MIR] Make InlineAsm a StatementSimonas Kazlauskas-6/+4
Previously InlineAsm was an Rvalue, but its semantics doesn’t really match the semantics of an Rvalue – rather it behaves more like a Statement.
2017-02-10Reimplement simplify_cfg for SwitchIntSimonas Kazlauskas-14/+18
First example of optimisation that applies to many more cases than originally.
2017-02-10SwitchInt over SwitchSimonas Kazlauskas-17/+0
This removes another special case of Switch by replacing it with the more general SwitchInt. While this is more clunky currently, there’s no reason we can’t make it nice (and efficient) to use.
2017-02-10If is now always a SwitchInt in MIRSimonas Kazlauskas-29/+12
2017-02-10Add Rvalue::Discriminant to retrieve discriminantSimonas Kazlauskas-0/+8
2017-02-03Add warning for () to ! switchAndrew Cann-1/+1
2017-01-30Merge ty::TyBox into ty::TyAdtVadim Petrochenkov-3/+4
2017-01-26rustc: rename TyCtxt's `map` field to `hir`.Eduard-Mihai Burtescu-9/+9
2017-01-11fix function arguments in constant promotionAriel Ben-Yehuda-13/+15
we can't create the target block until *after* we promote the arguments - otherwise the arguments will be promoted into the target block. oops. Fixes #38985.
2017-01-08Auto merge of #38837 - eddyb:issue-38074, r=nikomatsakisbors-13/+12
Allow projections to be promoted to constants in MIR. This employs the `LvalueContext` additions by @pcwalton to properly extend the MIR promotion of temporaries to allow projections (field accesses, indexing and dereferences) on said temporaries. It's needed both parity with the old constant qualification logic (for current borrowck) and it fixes #38074. The former is *required for soundness* if we accept the RFC for promoting rvalues to `'static` constants. That is, until we get MIR borrowck and the same source of truth will be used for both checks and codegen.
2017-01-06rustc: keep track of tables everywhere as if they were per-body.Eduard-Mihai Burtescu-2/+2
2017-01-05Allow projections to be promoted to constants in MIR.Eduard-Mihai Burtescu-13/+12
2017-01-05fix promotion of MIR terminatorsAriel Ben-Yehuda-79/+67
promotion of MIR terminators used to try to promote the destination it is trying to promote, leading to stack overflow. Fixes #37991.
2016-12-14Auto merge of #38332 - bluss:copy-prop-arguments, r=eddybbors-4/+6
Allow copy-propagation of function arguments Allow propagating function argument locals in copy propagation.
2016-12-12Auto merge of #38307 - bluss:mir-opt-level, r=eddybbors-13/+9
Simplify use of mir_opt_level Remove the unused top level option by the same name, and retain the debug option. Use -Zmir-opt-level=1 as default. One pass is enabled by default but wants to be optional: - Instcombine requires mir_opt_level > 0 Copy propagation is not used by default, but used to be activated by explicit -Zmir-opt-level=1. It must move one higher to be off by default: - CopyPropagation requires mir_opt_level > 1 Deaggregate is not used by default, and used to be on a different level than CopyPropagation: - Deaggreate requires mir_opt_level > 2
2016-12-11mir: Allow copy-propagation of function argumentsUlrik Sverdrup-4/+6
2016-12-11Simplify use of mir_opt_levelUlrik Sverdrup-13/+9
Remove the unused top level option by the same name, and retain the debug option. Use -Zmir-opt-level=1 as default. One pass is enabled by default but wants to be optional: - Instcombine requires mir_opt_level > 0 Copy propagation is not used by default, but used to be activated by explicit -Zmir-opt-level=1. It must move one higher to be off by default: - CopyPropagation requires mir_opt_level > 1 Deaggregate is not used by default, and used to be on a different level than CopyPropagation: - Deaggreate requires mir_opt_level > 2
2016-12-09mir: Reinstate while loop in deaggregator passUlrik Sverdrup-59/+58
A previous commit must have removed the `while let` loop here by mistake; for each basic block, it should find and deaggregate multiple statements in their index order, and the `curr` index tracks the progress through the block. This fixes both the case of deaggregating statements in separate basic blocks (preserving `curr` could prevent that) as well as multiple times in the same block (missing loop prevented that).
2016-12-05Refactor FnSig to contain a Slice for its inputs and outputs.Mark-Simulacrum-1/+1
2016-12-05Refactor ty::FnSig to privatize all fieldsMark-Simulacrum-8/+8
2016-11-29Auto merge of #37965 - Mark-Simulacrum:trait-obj-to-exis-predicate, r=eddybbors-1/+4
Refactor TraitObject to Slice<ExistentialPredicate> For reference, the primary types changes in this PR are shown below. They may add in the understanding of what is discussed below, though they should not be required. We change `TraitObject` into a list of `ExistentialPredicate`s to allow for a couple of things: - Principal (ExistentialPredicate::Trait) is now optional. - Region bounds are moved out of `TraitObject` into `TyDynamic`. This permits wrapping only the `ExistentialPredicate` list in `Binder`. - `BuiltinBounds` and `BuiltinBound` are removed entirely from the codebase, to permit future non-constrained auto traits. These are replaced with `ExistentialPredicate::AutoTrait`, which only requires a `DefId`. For the time being, only `Send` and `Sync` are supported; this constraint can be lifted in a future pull request. - Binder-related logic is extracted from `ExistentialPredicate` into the parent (`Binder<Slice<EP>>`), so `PolyX`s are inside `TraitObject` are replaced with `X`. The code requires a sorting order for `ExistentialPredicate`s in the interned `Slice`. The sort order is asserted to be correct during interning, but the slices are not sorted at that point. 1. `ExistentialPredicate::Trait` are defined as always equal; **This may be wrong; should we be comparing them and sorting them in some way?** 1. `ExistentialPredicate::Projection`: Compared by `ExistentialProjection::sort_key`. 1. `ExistentialPredicate::AutoTrait`: Compared by `TraitDef.def_path_hash`. Construction of `ExistentialPredicate`s is conducted through `TyCtxt::mk_existential_predicates`, which interns a passed iterator as a `Slice`. There are no convenience functions to construct from a set of separate iterators; callers must pass an iterator chain. The lack of convenience functions is primarily due to few uses and the relative difficulty in defining a nice API due to optional parts and difficulty in recognizing which argument goes where. It is also true that the current situation isn't significantly better than 4 arguments to a constructor function; but the extra work is deemed unnecessary as of this time. ```rust // before this PR struct TraitObject<'tcx> { pub principal: PolyExistentialTraitRef<'tcx>, pub region_bound: &'tcx ty::Region, pub builtin_bounds: BuiltinBounds, pub projection_bounds: Vec<PolyExistentialProjection<'tcx>>, } // after pub enum ExistentialPredicate<'tcx> { // e.g. Iterator Trait(ExistentialTraitRef<'tcx>), // e.g. Iterator::Item = T Projection(ExistentialProjection<'tcx>), // e.g. Send AutoTrait(DefId), } ```