summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2016-08-16Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakisbors-28/+18
Implement the `!` type This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
2016-08-14[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.Eduard Burtescu-19/+41
2016-08-13Rename empty/bang to neverAndrew Cann-1/+2
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Remove obsolete divergence related stuffAndrew Cann-28/+15
Replace FnOutput with Ty Replace FnConverging(ty) with ty Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13Switch on TyEmptyAndrew Cann-3/+5
Parse -> ! as FnConverging(!) Add AdjustEmptyToAny coercion to all ! expressions Some fixes
2016-08-13Auto merge of #35348 - scottcarr:discriminant2, r=nikomatsakisbors-17/+73
[MIR] Add explicit SetDiscriminant StatementKind for deaggregating enums cc #35186 To deaggregate enums, we need to be able to explicitly set the discriminant. This PR implements a new StatementKind that does that. I think some of the places that have `panics!` now could maybe do something smarter.
2016-08-12rustc: rename ProjectionMode and its variant to be more memorable.Eduard Burtescu-4/+4
2016-08-11Auto merge of #35592 - jonathandturner:rollup, r=jonathandturnerbors-3/+6
Rollup of 23 pull requests - Successful merges: #35279, #35331, #35358, #35375, #35445, #35448, #35482, #35486, #35505, #35528, #35530, #35532, #35536, #35537, #35541, #35552, #35554, #35555, #35557, #35562, #35565, #35569, #35576 - Failed merges: #35395, #35415, #35563
2016-08-11add SetDiscriminant StatementKind to enable deaggregation of enumsScott A Carr-17/+73
2016-08-11Rollup merge of #35445 - pcn:update-E0017-to-new-format, r=arielb1Jonathan Turner-3/+6
Update e0017 to new format Updated `span_err!` to use `struct_span_err!` and provide a `span_label` that describes the error in context. Updated the test to look for the `span_label`s that are provided now.
2016-08-11Auto merge of #35403 - scottcarr:lvalue_refactor, r=nikomatsakisbors-28/+26
refactor lvalue_ty to be method of lvalue Currently `Mir` (and `MirContext`) implement a method `lvalue_ty` (and actually many more `foo_ty`). But this should be a method of `Lvalue`. If you have an `lvalue` and you want to get its type, the natural thing to write is: ``` lvalue.ty() ``` Of course it needs context, but still: ``` lvalue.ty(mir, tcx) ``` Makes more sense than ``` mir.lvalue_ty(lvalue, tcx) ``` I actually think we should go a step farther and have traits so we could get the type of some value generically, but that's up for debate. The thing I'm running into a lot in the compiler is I have a value of type `Foo` and I know that there is some related type `Bar` which I can get through some combination of method calls, but it's often not as direct as I would imagine. Unless you already know the code, its not clear why you would look in `Mir` for a method to get the type of an `Lvalue`.
2016-08-09Auto merge of #35166 - nikomatsakis:incr-comp-ice-34991-2, r=mwbors-13/+11
Address ICEs running w/ incremental compilation and building glium Fixes for various ICEs I encountered trying to build glium with incremental compilation enabled. Building glium now works. Of the 4 ICEs, I have test cases for 3 of them -- I didn't isolate a test for the last commit and kind of want to go do other things -- most notably, figuring out why incremental isn't saving much *effort*. But if it seems worthwhile and I can come back and try to narrow down the problem. r? @michaelwoerister Fixes #34991 Fixes #32015
2016-08-08track MIR through the dep-graphNiko Matsakis-13/+11
Per the discussion on #34765, we make one `DepNode::Mir` variant and use it to represent both the MIR tracking map as well as passes that operate on MIR. We also track loads of cached MIR (which naturally comes from metadata). Note that the "HAIR" pass adds a read of TypeckItemBody because it uses a myriad of tables that are not individually tracked.
2016-08-08refactor other type methodsScott A Carr-16/+16
2016-08-07Updated the messages for E0017Peter C. Norton-3/+6
- Fix note message, fix tests.
2016-08-07Update E0010 to use the new formatPeter C. Norton-2/+4
For https://github.com/rust-lang/rust/issues/35194
2016-08-05refactor lvalue_ty to be method of lvalueScott A Carr-12/+10
2016-08-03reduce rightward drift, add precondition commentScott A Carr-15/+20
2016-08-02add hashtag to emphasis its a gh issueScott A Carr-1/+1
2016-08-02fix field type, add testScott A Carr-1/+1
2016-08-02reduce rightward drift, add fixmeScott A Carr-41/+41
2016-08-01deaggregate structs to enable further optimizationScott A Carr-0/+112
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-3/+3
2016-06-16fix MirSource::Promoted handlingAriel Ben-Yehuda-4/+1
2016-06-16stop having `'static` in dump-mir namesAriel Ben-Yehuda-0/+6
2016-06-09use the type name as the pass nameAriel Ben-Yehuda-19/+5
2016-06-09refactor simplify_cfg and split off simplify_branchesAriel Ben-Yehuda-133/+193
2016-06-09add hook infrastructure for automatically dumping MIR on every passAriel Ben-Yehuda-18/+91
2016-06-09introduce an `unreachable` terminatorAriel Ben-Yehuda-1/+5
Use it instead of a `panic` for inexhaustive matches and correct the comment. I think we trust our match-generation algorithm enough to generate these blocks, and not generating an `unreachable` means that LLVM won't optimize `match void() {}` to an `unreachable`.
2016-06-09add a cache for MIR predecessorsAriel Ben-Yehuda-20/+4
2016-06-09make the basic_blocks field privateAriel Ben-Yehuda-55/+52
2016-06-09introduce the type-safe IdxVec and use it instead of loose indexesAriel Ben-Yehuda-71/+73
2016-06-09merge the RemoveDeadBlocks pass into the SimplifyCfg passAriel Ben-Yehuda-98/+62
2016-06-09implement RFC495 semantics for slice patternsAriel Ben-Yehuda-1/+21
non-MIR translation is still not supported for these and will happily ICE. This is a [breaking-change] for many uses of slice_patterns.
2016-06-08remove the librustc_trans -> librustc_mir dependencyAriel Ben-Yehuda-7/+4
2016-06-07mir: group span + visibility scope under a new SourceInfo type.Eduard Burtescu-33/+37
2016-06-07mir: distinguish between variable visibility scopes and SEME scopes.Eduard Burtescu-3/+3
2016-06-05Add a new Assert terminator to MIR for bounds & arithmetic checks.Eduard Burtescu-65/+30
2016-06-05Check arithmetic in the MIRJames Miller-0/+1
Add, Sub, Mul, Shl, and Shr are checked using a new Rvalue: CheckedBinaryOp, while Div, Rem and Neg are handled with explicit checks in the MIR.
2016-06-05break critical edges only when neededAriel Ben-Yehuda-43/+56
the *only* place where critical edges need to be broken is on Call instructions, so only break them there.
2016-06-03check for is_cleanup violations in MIR typeckAriel Ben-Yehuda-3/+65
There weren't any in practice, but as these cause MSVC-only problems, the check looks like a good idea.
2016-06-03introduce DropAndReplace for translating assignmentsAriel Ben-Yehuda-5/+21
this introduces a DropAndReplace terminator as a fix to #30380. That terminator is suppsoed to be translated by desugaring during drop elaboration, which is not implemented in this commit, so this breaks `-Z orbit` temporarily.
2016-05-31normalize types in MIR typeck after erasing regionsAriel Ben-Yehuda-25/+24
2016-05-15Auto merge of #33620 - eddyb:oops-static-is-not-fn, r=dotdashbors-3/+3
mir: always allow &mut [...] in static mut regardless of the array length.
2016-05-14Rollup merge of #33552 - dotdash:scfg, r=luqmanaManish Goregaokar-59/+124
[MIR] Enhance the SimplifyCfg pass to merge consecutive blocks Updated from #30238, including the changes suggested by @Aatch.
2016-05-14Rollup merge of #33544 - dotdash:baby_dont_break_me_no_more, r=AatchManish Goregaokar-118/+112
Only break critical edges where actually needed Currently, to prepare for MIR trans, we break _all_ critical edges, although we only actually need to do this for edges originating from a call that gets translated to an invoke instruction in LLVM. This has the unfortunate effect of undoing a bunch of the things that SimplifyCfg has done. A particularly bad case arises when you have a C-like enum with N variants and a derived PartialEq implementation. In that case, the match on the (&lhs, &rhs) tuple gets translated into nested matches with N arms each and a basic block each, resulting in N² basic blocks. SimplifyCfg reduces that to roughly 2*N basic blocks, but breaking the critical edges means that we go back to N². In nickel.rs, there is such an enum with roughly N=800. So we get about 640K basic blocks or 2.5M lines of LLVM IR. LLVM takes a while to reduce that to the final "disr_a == disr_b". So before this patch, we had 2.5M lines of IR with 640K basic blocks, which took about about 3.6s in LLVM to get optimized and translated. After this patch, we get about 650K lines with about 1.6K basic blocks and spent a little less than 0.2s in LLVM. cc #33111 r? @Aatch
2016-05-13mir: always allow &mut [...] in static mut regardless of the array length.Eduard Burtescu-3/+3
2016-05-13Auto merge of #33541 - eddyb:promote-only-temps, r=arielb1bors-6/+18
mir: don't attempt to promote Unpromotable constant temps. Fixes #33537. This was a non-problem in regular functions, but we also promote in `const fn`s. There we always qualify temps so you can't depend on `Unpromotable` temps being `NOT_CONST`.
2016-05-13[MIR] Enhance the SimplifyCfg pass to merge consecutive blocksBjörn Steinbrink-59/+124
2016-05-11Only break critical edges where actually neededBjörn Steinbrink-118/+112
Currently, to prepare for MIR trans, we break _all_ critical edges, although we only actually need to do this for edges originating from a call that gets translated to an invoke instruction in LLVM. This has the unfortunate effect of undoing a bunch of the things that SimplifyCfg has done. A particularly bad case arises when you have a C-like enum with N variants and a derived PartialEq implementation. In that case, the match on the (&lhs, &rhs) tuple gets translated into nested matches with N arms each and a basic block each, resulting in N² basic blocks. SimplifyCfg reduces that to roughly 2*N basic blocks, but breaking the critical edges means that we go back to N². In nickel.rs, there is such an enum with roughly N=800. So we get about 640K basic blocks or 2.5M lines of LLVM IR. LLVM takes a while to reduce that to the final "disr_a == disr_b". So before this patch, we had 2.5M lines of IR with 640K basic blocks, which took about about 3.6s in LLVM to get optimized and translated. After this patch, we get about 650K lines with about 1.6K basic blocks and spent a little less than 0.2s in LLVM. cc #33111