about summary refs log tree commit diff
path: root/src/librustc/mir/mod.rs
AgeCommit message (Collapse)AuthorLines
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-2666/+0
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-5/+5
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-24Rollup merge of #69981 - oli-obk:const_blocks, r=eddybMazdak Farrokhzad-332/+23
Evaluate repeat expression lengths as late as possible Fixes #68567 r? @varkor
2020-03-23Split out some impls from rustc::mir into a separate submoduleOliver Scherer-322/+1
2020-03-23Split long derive lists into two derive attributes.Ana-Maria Mihalache-24/+4
2020-03-23Evaluate repeat expression lengths as late as possibleOliver Scherer-10/+22
2020-03-16Auto merge of #67133 - oli-obk:it_must_be_a_sign, r=eddybbors-8/+8
Deduplicate pretty printing of constants r? @eddyb for the pretty printing logic cc @RalfJung
2020-03-14Rollup merge of #69809 - matthiaskrgr:lifetimes, r=eddybYuki Okushi-2/+2
remove lifetimes that can be elided (clippy::needless_lifetimes)
2020-03-12remove lifetimes that can be elided (clippy::needless_lifetimes)Matthias Krüger-2/+2
2020-03-12Rollup merge of #69747 - spastorino:rename-rustc-guide, r=pietroalbiniMazdak Farrokhzad-2/+2
Rename rustc guide This is in preparation for https://github.com/rust-lang/rustc-guide/issues/470 Needs to be merged after we actually rename the guide. Have used this to rename: `git grep -l 'rustc_guide' | xargs sed -i 's/rustc_guide/rustc_dev_guide/g'` `git grep -l 'rustc-guide' | xargs sed -i 's/rustc-guide/rustc-dev-guide/g'` `git grep -l 'rustc guide' | xargs sed -i 's/rustc guide/rustc dev guide/g'`
2020-03-11Deduplicate and clean up pretty printing logicOliver Scherer-8/+8
2020-03-10rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.orgSantiago Pastorino-1/+1
2020-03-10Rename rustc guide to rustc dev guideSantiago Pastorino-2/+2
2020-03-10Rename rustc-guide to rustc-dev-guideSantiago Pastorino-1/+1
2020-03-10Rollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obkMazdak Farrokhzad-4/+4
Make PlaceRef take just one lifetime r? @eddyb
2020-03-07Rollup merge of #69656 - matthiaskrgr:iter_nth_zero, r=oli-obkMazdak Farrokhzad-1/+1
Use .next() instead of .nth(0) on iterators.
2020-03-05Const items have by default a static lifetime, there's no need to annotate ↵Matthias Krüger-1/+1
it. (clippy::redundant_static_lifetimes)
2020-03-04PlaceRef<'a, 'tcx> -> PlaceRef<'tcx>Santiago Pastorino-4/+4
2020-03-03Use .next() instead of .nth(0) on iterators.Matthias Krüger-1/+1
2020-03-02Make PlaceRef lifetimes of Place::as_ref be both 'tcxSantiago Pastorino-1/+1
2020-03-03Simplify conditions like x + 1 <= y to x < yMatthias Krüger-1/+1
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-2/+2
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-1/+1
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-1/+1
example: let s: String = format!("hello").into();
2020-02-27Auto merge of #68528 - ecstatic-morse:maybe-init-variants, r=oli-obkbors-0/+9
Mark other variants as uninitialized after switch on discriminant During drop elaboration, which builds the drop ladder that handles destruction during stack unwinding, we attempt to remove MIR `Drop` terminators that will never be reached in practice. This reduces the number of basic blocks that are passed to LLVM, which should improve performance. In #66753, a user pointed out that unreachable `Drop` terminators are common in functions like `Option::unwrap`, which move out of an `enum`. While discussing possible remedies for that issue, @eddyb suggested moving const-checking after drop elaboration. This would allow the former, which looks for `Drop` terminators and replicates a small amount of drop elaboration to determine whether a dropped local has been moved out, leverage the work done by the latter. However, it turns out that drop elaboration is not as precise as it could be when it comes to eliminating useless drop terminators. For example, let's look at the code for `unwrap_or`. ```rust fn unwrap_or<T>(opt: Option<T>, default: T) -> T { match opt { Some(inner) => inner, None => default, } } ``` `opt` never needs to be dropped, since it is either moved out of (if it is `Some`) or has no drop glue (if it is `None`), and `default` only needs to be dropped if `opt` is `Some`. This is not reflected in the MIR we currently pass to codegen. ![pasted_image](https://user-images.githubusercontent.com/29463364/73384403-109a0d80-4280-11ea-8500-0637b368f2dc.png) @eddyb also suggested the solution to this problem. When we switch on an enum discriminant, we should be marking all fields in other variants as definitely uninitialized. I implemented this on top of alongside a small optimization (split out into #68943) that suppresses drop terminators for enum variants with no fields (e.g. `Option::None`). This is the resulting MIR for `unwrap_or`. ![after](https://user-images.githubusercontent.com/29463364/73384823-e432c100-4280-11ea-84bd-d0bcc3b777b4.png) In concert with #68943, this change speeds up many [optimized and debug builds](https://perf.rust-lang.org/compare.html?start=d55f3e9f1da631c636b54a7c22c1caccbe4bf0db&end=0077a7aa11ebc2462851676f9f464d5221b17d6a). We need to carefully investigate whether I have introduced any miscompilations before merging this. Code that never drops anything would be very fast indeed until memory is exhausted.
2020-02-16suspend -> yieldJonas Schievink-3/+1
2020-02-16Fix printing of `Yield` terminatorJonas Schievink-8/+10
2020-02-13Add `Place` getter to `Operand`Dylan MacKenzie-0/+9
2020-02-13rename PanicInfo -> AssertKindRalf Jung-9/+9
2020-02-13move PanicInfo to mir moduleRalf Jung-2/+55
2020-02-13remove PanicInfo::Panic variant that MIR does not use or needRalf Jung-4/+2
2020-02-02Add resume arg place to `Yield` MIR terminatorJonas Schievink-3/+8
2020-01-28Remove unneeded & on match patternSantiago Pastorino-2/+2
2020-01-28Local field on PlaceRef and RootPlace is not a reference anymoreSantiago Pastorino-7/+7
2020-01-27make matches exhaustiveMatthias Krüger-6/+14
2020-01-27don't clone types that are copy, round two.Matthias Krüger-5/+5
2020-01-14Add test for `ResultsCursor`Dylan MacKenzie-0/+25
This is a unit test that ensures the `seek` functions work correctly.
2020-01-12Split `rustc_mir::{build, hair, lints}` into their own crateMatthew Jasper-221/+4
2020-01-10Make Place CopySantiago Pastorino-1/+1
2020-01-10No need to use local.into hereSantiago Pastorino-1/+1
2020-01-10Remove PlaceBase enum and make Place base field be local: LocalSantiago Pastorino-51/+13
2020-01-10Remove Static from PlaceBaseSantiago Pastorino-48/+6
2020-01-10Remove StaticKindSantiago Pastorino-39/+4
2020-01-10Remove StaticKind::PromotedSantiago Pastorino-20/+5
2020-01-10Promote `Ref`s to constants instead of staticSantiago Pastorino-0/+11
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-3/+4
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-22Format the worldMark Rousskov-119/+119
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-17/+2
2. mir::Mutability -> ast::Mutability.