about summary refs log tree commit diff
path: root/src/librustc_mir/dataflow/move_paths
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1028/+0
2020-08-23 change offset from u32 to u64DPC-1/+1
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-0/+1
2020-06-16rename location field of Drop terminators to placeRalf Jung-5/+5
2020-06-12Rollup merge of #73033 - Amanieu:asm-tls, r=oli-obkDylan DPC-1/+1
Fix #[thread_local] statics as asm! sym operands The `asm!` RFC specifies that `#[thread_local]` statics may be used as `sym` operands for inline assembly. This also fixes a regression in the handling of `#[thread_local]` during monomorphization which caused link-time errors with multiple codegen units, most likely introduced by #71192. r? @oli-obk
2020-06-10Track span of function in method calls, and use this in #[track_caller]Aaron Hill-0/+1
Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-1/+1
2020-06-06Fix #[thread_local] statics as asm! sym operandsAmanieu d'Antras-1/+1
2020-06-04placate tidy.Felix S. Klock II-1/+1
2020-06-04Revert "Reduce the number of drop-flag assignments in unwind paths"Felix S. Klock II-1/+4
This reverts commit 54aa418a6082b364b90feee70b07381ea266c4d5.
2020-06-04Revert "Address review comments"Felix S. Klock II-6/+2
This reverts commit b998497bd41d6de71ec035433247dee856d1f3a5.
2020-06-01Auto merge of #71192 - oli-obk:eager_alloc_id_canonicalization, r=wesleywiserbors-0/+1
Make TLS accesses explicit in MIR r? @rust-lang/wg-mir-opt cc @RalfJung @vakaras for miri thread locals cc @bjorn3 for cranelift fixes #70685
2020-05-30Make TLS accesses explicit in MIROliver Scherer-0/+1
2020-05-29Improve inline asm error diagnosticsAmanieu d'Antras-1/+7
2020-05-23take mir::PlaceElem by valueBastian Kauschke-3/+3
2020-05-23iterate List by valueBastian Kauschke-1/+1
2020-05-18Add asm! to MIRAmanieu d'Antras-0/+25
2020-05-09Address review commentsMatthew Jasper-2/+6
2020-05-09Reduce the number of drop-flag assignments in unwind pathsMatthew Jasper-4/+1
2020-04-16don't clone types that are copy (clippy::clone_on_copy)Matthias Krüger-4/+3
2020-03-31Use Place directly, it's Copy even more use casesSantiago Pastorino-19/+19
2020-03-30Use if let instead of match when only matching a single variant ↵Matthias Krüger-4/+5
(clippy::single_match) Makes code more compact and reduces nestig.
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-3/+3
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-7/+7
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-1/+1
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-22don't create variable bindings just to return the bound value immediately ↵Matthias Krüger-3/+2
(clippy::let_and_return)
2020-03-10Rollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obkMazdak Farrokhzad-2/+2
Make PlaceRef take just one lifetime r? @eddyb
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-1/+1
2020-03-04PlaceRef<'a, 'tcx> -> PlaceRef<'tcx>Santiago Pastorino-2/+2
2020-03-04Make PlaceRef lifetimes of in_projection be both 'tcxSantiago Pastorino-1/+1
2020-02-27Auto merge of #68528 - ecstatic-morse:maybe-init-variants, r=oli-obkbors-10/+42
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-19Reorder yield visitation order to match callJonas Schievink-1/+1
2020-02-13Use an `Iterator` for `MovePath` traversalDylan MacKenzie-10/+42
2020-02-10Implement a `find_descendant` method for `MovePath`Dylan MacKenzie-0/+47
2020-02-02Add resume arg place to `Yield` MIR terminatorJonas Schievink-1/+3
2020-01-28Place::ty_from takes local by valueSantiago Pastorino-2/+2
2020-01-28Local field on PlaceRef and RootPlace is not a reference anymoreSantiago Pastorino-2/+2
2020-01-27don't clone types that are copy, round two.Matthias Krüger-8/+6
2020-01-10Remove PlaceBase enum and make Place base field be local: LocalSantiago Pastorino-12/+8
2020-01-10Remove Static from PlaceBaseSantiago Pastorino-7/+0
2020-01-06Improve hygiene of `newtype_index`Matthew Jasper-1/+1
Also add unit tests
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-22Format the worldMark Rousskov-37/+27
2019-12-20Rollup merge of #67314 - matthewjasper:union-move-errors, r=nikomatsakisMazdak Farrokhzad-9/+22
Don't suppress move errors for union fields closes #66500
2019-12-19Don't suppress move errors for union fieldsMatthew Jasper-9/+22
2019-12-18Add Rvalue::AddressOf to MIRMatthew Jasper-0/+1
This operator creates a raw pointer to a Place directly, without first creating a reference. See RFC #2582 for motivation. The Rvalue is currently unused.
2019-12-09Remove `uniform_array_move_out` passesMatthew Jasper-38/+93
These passes were buggy, MIR building is now responsible for canonicalizing `ConstantIndex` projections and `MoveData` is responsible for splitting `Subslice` projections.
2019-12-09Make const index and subslice array projections more usefulMatthew Jasper-4/+5
* `min_length` is now exact for const index elements. * const index elements are always from the start. * make array `Subslice` `PlaceElems` count both `from` and `to` from the start.
2019-10-22Move Place::elem methods and friends to TyCtxtSantiago Pastorino-1/+1