summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2020-03-10Rollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obkMazdak Farrokhzad-5/+5
Make PlaceRef take just one lifetime r? @eddyb
2020-03-07Rollup merge of #69787 - spastorino:use-local-directly-its-copy, r=oli-obkMazdak Farrokhzad-1/+1
mir::Local is Copy we can pass it by value in these cases r? @oli-obk
2020-03-06mir::Local is Copy we can pass it by value in these casesSantiago Pastorino-1/+1
2020-03-06fix various typosMatthias Krüger-2/+2
2020-03-04PlaceRef<'a, 'tcx> -> PlaceRef<'tcx>Santiago Pastorino-5/+5
2020-03-04Don't use "if let" bindings to only check a value and not actually bind ↵Matthias Krüger-1/+1
anything. For example: `if let Some(_) = foo() {}` can be reduced to `if foo().is_some() {}` (clippy::redundant_pattern_matching)
2020-03-03Rollup merge of #69650 - matthiaskrgr:clnp, r=varkorDylan DPC-1/+1
cleanup more iterator usages (and other things) * Improve weird formatting by moving comment inside else-code block. * Use .any(x) instead of .find(x).is_some() on iterators. * Use .nth(x) instead of .skip(x).next() on iterators. * Simplify conditions like x + 1 <= y to x < y * Use let instead of match to get value of enum with single variant.
2020-03-03Make PlaceRef lifetimes of monomorphized_place_ty be both 'tcxSantiago Pastorino-1/+1
2020-03-03Make PlaceRef lifetimes of codegen_place be both 'tcxSantiago Pastorino-3/+3
2020-03-03Improve linking of crates with circular dependenciesTomasz Miąsko-7/+15
Previously, the code responsible for handling the cycles between crates introduces through weak lang items, would keep a set of missing language items: * extending it with items missing from the current crate, * removing items provided by the current crate, * grouping the crates when the set changed from non-empty back to empty. This could produce incorrect results, if a lang item was missing from a crate that comes after the crate that provides it (in the loop iteration order). In that case the grouping would not take place. The changes here address this specific failure scenario by keeping track of two separate sets of crates. Those that are required to link successfully, and those that are available for linking. Verified using test case from 69368.
2020-03-02Make PlaceRef lifetimes of LocalAnalyzer::process_place be both 'tcxSantiago Pastorino-1/+1
2020-03-03Use .nth(x) instead of .skip(x).next() on iterators.Matthias Krüger-1/+1
2020-03-01Rollup merge of #69569 - matthiaskrgr:nonminimal_bool, r=mark-SimulacrumDylan DPC-2/+2
simplify boolean expressions
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-5/+5
2020-02-29Make it build againVadim Petrochenkov-1/+1
2020-02-29simplify boolean expressionsMatthias Krüger-2/+2
2020-02-28simplify condition in start_executing_work()Matthias Krüger-5/+5
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-8/+8
2020-02-28Rollup merge of #69529 - matthiaskrgr:clippy_identity_conversion, ↵Dylan DPC-3/+2
r=Mark-Simulacrum don't use .into() to convert types into identical types. This removes redundant `.into()` calls. example: `let s: String = format!("hello").into();`
2020-02-28Rollup merge of #69379 - jumbatm:llvm-sigsegv, r=pnkfelixDylan DPC-2/+2
Fail on multiple declarations of `main`. Closes #67946. Previously, when inserting the entry function, we only checked for duplicate _definitions_ of `main`. However, it's possible to cause problems even only having a duplicate _declaration_. For example, shadowing `main` using an extern block isn't caught by the current check, and causes an assertion failure down the line in in LLVM code. r? @pnkfelix
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-3/+2
example: let s: String = format!("hello").into();
2020-02-26Rollup merge of #69429 - matthiaskrgr:clippy_, r=estebankDylan DPC-1/+1
remove redundant clones and import
2020-02-24no more codegen for miri_start_panicRalf Jung-5/+2
2020-02-24librustc{, codegen_ssa,infer,mir_build}: don't clone types that are copyMatthias Krüger-1/+1
2020-02-23Auto merge of #69351 - mati865:mingw-ultimate-fix, r=cramertjbors-9/+15
Improve external MinGW detection Fixes #68872
2020-02-23Fail on multiple declarations of `main`.jumbatm-2/+2
Previously, when inserting the entry function, we only checked for duplicate _definitions_ of `main`. However, it's possible to cause problems even only having a duplicate _declaration_. For example, shadowing `main` using an extern block isn't caught by the current check, and causes an assertion failure down the line in in LLVM code.
2020-02-21Detect Chocolatey MinGW installationMateusz Mikuła-3/+10
2020-02-21Fix MinGW detection for CygwinMateusz Mikuła-8/+7
2020-02-16Code review changes.Ben Lewis-2/+2
2020-02-15Monomorphize const type during codegen.Ben Lewis-1/+2
2020-02-15Change `const_field` and `const_caller_location` to return `ConstValue` ↵Ben Lewis-26/+25
instead of `Const` as the type in the returned const isn't needed.
2020-02-15Change const eval to return `ConstValue`, instead of `Const` as the type ↵Ben Lewis-2/+8
inside it shouldn't be used.
2020-02-13rename PanicInfo -> AssertKindRalf Jung-3/+3
2020-02-13move PanicInfo to mir moduleRalf Jung-1/+1
2020-02-12Rollup merge of #67954 - nikic:new-pm, r=nagisaDylan DPC-0/+3
Support new LLVM pass manager Add support for the new LLVM pass manager behind a `-Z new-llvm-pass-manager=on` option. Both the pre-link optimization and LTO pipelines use the new pass manager. There's some bits that are not supported yet: * `-C passes`. NewPM requires an entirely different way of specifying custom pass pipelines. We should probably expose that functionality, but it doesn't directly map to what `-C passes` does. * NewPM has no support for custom inline parameters right now. We'd have to add upstream support for that first. * NewPM does not support PGO at O0 in LLVM 9 (which is why those tests fail with NewPM enabled). This is supported in LLVM 10. * NewPM does not support MergeFunctions in LLVM 9. I've landed this upstream just before the cut, so we'll be able to re-enable that with LLVM 10. Closes #64289. r? @ghost
2020-02-12Add support for new pass managerNikita Popov-0/+3
The new pass manager can be enabled using -Z new-llvm-pass-manager=on.
2020-02-12Rollup merge of #68994 - Keruspe:sanitizers-conflict, r=Mark-SimulacrumDylan DPC-2/+9
rustbuild: include channel in sanitizers installed name Allows parallel install of different rust channels. I'm not sure if the channel is the right thing to use there, but currently both beta and nightly try to install e.g. `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_rt.asan.a` when before (and in current stable) it used to be `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_asan-45a4390180e83d28.rlib` which contained a hash, making it unique. With this patch, `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-nightly_rt.asan.a` gets installed
2020-02-11Merge rustc::middle::*lang_items.Camille GILLOT-6/+3
2020-02-11Rollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPCDylan DPC-4/+0
Remove unused feature gates I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
2020-02-11rustbuild: include channel in sanitizers installed nameMarc-Antoine Perennou-2/+9
Allows parallel install of different rust channels Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-02-11Auto merge of #68961 - eddyb:dbg-stack-dunk, r=nagisabors-32/+37
rustc_codegen_ssa: only "spill" SSA-like values to the stack for debuginfo. This is an implementation of the idea described in https://github.com/rust-lang/rust/issues/68817#issuecomment-583719182. In short, instead of debuginfo forcing otherwise-SSA-like MIR locals into `alloca`s, and requiring a `load` for each use (or two, for scalar pairs), the `alloca` is now *only* used for attaching debuginfo with `llvm.dbg.declare`: the `OperandRef` is stored to the `alloca`, but *never loaded* from it. Outside of `debug_introduce_local`, nothing cares about the debuginfo-only `alloca`, and instead works with `OperandRef` the same as MIR locals without debuginfo before this PR. This should have some of the benefits of `llvm.dbg.value`, while working today. cc @nagisa @nikomatsakis
2020-02-10Rollup merge of #68932 - ↵Dylan DPC-7/+14
michaelwoerister:self-profile-generic-activity-args, r=wesleywiser self-profile: Support arguments for generic_activities. This PR adds support for recording arguments of "generic activities". The most notable use case is LLVM module names, which should be very interesting for `crox` profiles. In the future it might be interesting to add more fine-grained events for pre-query passes like macro expansion. I tried to judiciously de-duplicate existing self-profile events with `extra_verbose_generic_activity`, now that the latter also generates self-profile events. r? @wesleywiser
2020-02-10self-profile: Support arguments for generic_activities.Michael Woerister-7/+14
2020-02-09rustc_codegen_ssa: only "spill" SSA-like values to the stack for debuginfo.Eduard-Mihai Burtescu-32/+34
2020-02-09rustc_codegen_ssa: use `debug_introduce_local` on Operand call results.Eduard-Mihai Burtescu-0/+3
2020-02-09Auto merge of #68975 - Dylan-DPC:rollup-jzab8oh, r=Dylan-DPCbors-25/+4
Rollup of 7 pull requests Successful merges: - #68718 (Move `rustc_hir::def_id` to `rustc_span::def_id`) - #68834 (Fix and test implementation of BTreeMap's first/last_entry, pop_first/last) - #68857 (perf: Reduce Vec allocations in normalization by passing &mut Vec) - #68918 (Don't use the word "unwrap" to describe "unwrap" methods) - #68946 (Mark several functions and methods in core::cmp as #[must_use]) - #68958 (Clean up E0277 and E0282 explanations) - #68960 (codegen: misc cleanups around debuginfo scopes and locations.) Failed merges: r? @ghost
2020-02-08Auto merge of #68802 - eddyb:debuginfo-there-can-only-be-one-arg, r=nagisabors-4/+1
rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments. Fixes #67586 by limiting `ArgumentVariable` special-casing to `VarDebugInfo` entries that are in `OUTERMOST_SOURCE_SCOPE`, i.e. the function's own argument scope. That excludes `VarDebugInfo` from inlined callees, which can also point to the caller's argument locals. This is a snippet from the optimized MIR (including inlining) of the testcase: ```rust fn foo(_1: usize) -> usize { debug bar => _1; // in scope 0 at ./example.rs:2:12: 2:15 let mut _0: usize; // return place in scope 0 at ./example.rs:2:27: 2:32 scope 1 { debug x => _1; // in scope 1 at /rustc/9ed29b6ff6aa2e048b09c27af8f62ee3040bdb37/src/libcore/convert/mod.rs:106:26: 106:27 } ``` `scope 1` is from inlining the `identity` call, and `debug x => _1;` comes from the body of `core::convert::identity`, so they are now ignored for the purposes of determining the `ArgumentVariable` debuginfo associated to `_1`.
2020-02-08rustc_codegen_ssa: remove unnecessary source_locations_enabled.Eduard-Mihai Burtescu-18/+4
2020-02-08rustc_codegen_llvm: remove InternalDebugLocation and simplify dbg_var_addr.Eduard-Mihai Burtescu-7/+0
2020-02-07Rollup merge of #68164 - tmiasko:no-sanitize, r=nikomatsakisDylan DPC-10/+12
Selectively disable sanitizer instrumentation Add `no_sanitize` attribute that allows to opt out from sanitizer instrumentation in an annotated function.