about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2019-07-20Remove explicit return from last line of fnSantiago Pastorino-1/+1
2019-07-20Avoid cloning Place in codegen_placeSantiago Pastorino-40/+42
2019-07-20Implement Place::as_place_refSantiago Pastorino-6/+1
2019-07-20Avoid cloning place in LocalAnalyzer visitorSantiago Pastorino-56/+85
2019-07-20Migrate from Place enum to Place structSantiago Pastorino-41/+92
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-2/+2
2019-07-13Auto merge of #62584 - eddyb:circular-math-is-hard, r=pnkfelixbors-24/+62
rustc_codegen_ssa: fix range check in codegen_get_discr. Fixes #61696, see https://github.com/rust-lang/rust/issues/61696#issuecomment-505473018 for more details. In short, I had wanted to use `x - a <= b - a` to check whether `x` is in `a..=b` (as it's 1 comparison instead of 2 *and* `b - a` is guaranteed to fit in the same data type, while `b` itself might not), but I ended up with `x - a + c <= b - a + c` instead, because `x - a + c` was the final value needed. That latter comparison is equivalent to checking that `x` is in `(a - c)..=b`, i.e. it also includes `(a - c)..a`, not just `a..=b`, so if `c` is not `0`, it will cause false positives. This presented itself as the non-niche ("dataful") variant sometimes being treated like a niche variant, in the presence of uninhabited variants (which made `c`, aka the index of the first niche variant, arbitrarily large). r? @nagisa, @rkruppe or @oli-obk
2019-07-12rustc_codegen_ssa: fix range check in codegen_get_discr.Eduard-Mihai Burtescu-23/+47
2019-07-12Replace `struct_tail` and `struct_lockstep_tails` with variants handling ↵Felix S. Klock II-3/+5
normalization. The old struct tail functions did not deal with `<T as Trait>::A` and `impl Trait`, at least not explicitly. (We didn't notice this bug before because it is only exposed when the tail (post deep normalization) is not `Sized`, so it was a rare case to deal with.) For post type-checking (i.e. during codegen), there is now `struct_tail_erasing_lifetimes` and `struct_lockstep_tails_erasing_lifetimes`, which each take an additional `ParamEnv` argument to drive normalization. For pre type-checking cases where normalization is not needed, there is `struct_tail_without_normalization`. (Currently, the only instance of this is `Expectation::rvalue_hint`.) All of these new entrypoints work by calling out to common helper routines. The helpers are parameterized over a closure that handles the normalization.
2019-07-11rustc_codegen_ssa: try to make codegen_get_discr more readable.Eduard-Mihai Burtescu-18/+32
2019-07-10Rollup merge of #62474 - nikic:update-llvm, r=alexcrichtonMazdak Farrokhzad-0/+1
Prepare for LLVM 9 update Main changes: * In preparation for opaque pointer types, the `byval` attribute now takes a type. As such, the argument type needs to be threaded through to the function/callsite attribute application logic. * On ARM the `+fp-only-sp` and `+d16` features have become `-fp64` and `-d32`. I've switched the target definitions to use the new names, but also added bidirectional emulation so either can be used on any LLVM version for backwards compatibility. * The datalayout can now specify function pointer alignment. In particular on ARM `Fi8` is specified, which means that function pointer alignment is independent of function alignment. I've added this to our datalayouts to match LLVM (which is something we check) and strip the fnptr alignment for older LLVM versions. * The fmul/fadd reductions now always respect the accumulator (including for unordered reductions), so we should pass the identity instead of undef. Open issues: * https://reviews.llvm.org/D62106 causes linker errors with ld.bdf due to https://sourceware.org/bugzilla/show_bug.cgi?id=24784. To avoid this I've enabled `RelaxELFRelocations`, which results in a GOTPCRELX relocation for `__tls_get_addr` and avoids the issue. However, this is likely not acceptable because relax relocations are not supported by older linker versions. We may need an LLVM option to keep using PLT for `__tls_get_addr` despite `RtLibUseGOT`. The corresponding llvm-project PR is https://github.com/rust-lang/llvm-project/pull/19. r? @ghost
2019-07-09Fix float add/mul reduction codegenNikita Popov-0/+1
The accumulator is now respected for unordered reductions.
2019-07-09Remove unused dependenciesShotaro Yamada-1/+0
2019-07-08normalize use of backticks for compiler messages in librustc_codegenSamy Kacimi-2/+2
https://github.com/rust-lang/rust/issues/60532
2019-07-07rustc: Remove `dylib` crate type from most rustc cratesAlex Crichton-1/+0
Now that procedural macros no longer link transitively to libsyntax, this shouldn't be needed any more! This commit is an experiment in removing all dynamic libraries from rustc except for librustc_driver itself. Let's see how far we can get with that!
2019-07-05Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=ZoxcMazdak Farrokhzad-2/+2
The (almost) culmination of HirIdification It's finally over. This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name. All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.
2019-07-05Rollup merge of #62110 - nnethercote:improve-Ztime-passes, r=ZoxcMazdak Farrokhzad-2/+5
Improve -Ztime-passes Two improvements that make `-Ztime-passes` more useful. r? @Zoxc
2019-07-05Rollup merge of #61545 - flip1995:internal_lints, r=oli-obkMazdak Farrokhzad-1/+0
Implement another internal lints cc #49509 This adds ~~two~~ one internal lint~~s~~: 1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669 2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~ ~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~ TODO (not directly relevant for review): - [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) :thinking: cc @eddyb) - [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870 - [x] Check explicitly for the `{declare,impl}_lint_pass!` macros r? @oli-obk
2019-07-05Add a "total" measurement to -Ztime-passes.Nicholas Nethercote-2/+5
This is useful for getting the total compilation time at the end. To do this, the patch changes `print_time_passes_entry` to not increment the depth, which means that `print_time_passes_entry_internal` is no longer needed.
2019-07-04rename hir::map::local_def_id_from_hir_id to local_def_idljedrz-2/+2
2019-07-04Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, ↵Mazdak Farrokhzad-7/+5
r=dtolnay,Centril Use mem::take instead of mem::replace with default
2019-07-04Rollup merge of #62039 - jeremystucki:needless_lifetimes, r=eddybMazdak Farrokhzad-19/+19
Remove needless lifetimes (rustc)
2019-07-03Rollup merge of #62021 - crlf0710:msvc_link_output_improve, r=alexcrichtonMark Rousskov-4/+8
MSVC link output improve Resolves #35785. However i haven't come up with a idea to add test case for this :( r? @retep998
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-07-03Remove needless lifetimesJeremy Stucki-15/+15
2019-07-03Remove needless lifetimesJeremy Stucki-2/+2
2019-07-02Auto merge of #61268 - michaelwoerister:stabilize-pgo, r=alexcrichtonbors-4/+4
Stabilize support for Profile-guided Optimization This PR makes profile-guided optimization available via the `-C profile-generate` / `-C profile-use` pair of commandline flags and adds end-user documentation for the feature to the [rustc book](https://doc.rust-lang.org/rustc/). The PR thus ticks the last two remaining checkboxes of the [stabilization tracking issue](https://github.com/rust-lang/rust/issues/59913). From the tracking issue: > Profile-guided optimization (PGO) is a common optimization technique for ahead-of-time compilers. It works by collecting data about a program's typical execution (e.g. probability of branches taken, typical runtime values of variables, etc) and then uses this information during program optimization for things like inlining decisions, machine code layout, or indirect call promotion. If you are curious about how this can be used, there is a rendered version of the documentation this PR adds available [here]( https://github.com/michaelwoerister/rust/blob/stabilize-pgo/src/doc/rustc/src/profile-guided-optimization.md). r? @alexcrichton cc @rust-lang/compiler
2019-07-01Enable mem_take feature in relevant cratesChris Gregory-0/+1
2019-07-01Convert more usages overChris Gregory-7/+4
2019-06-27rustc: Retry SIGILL linker invocationsAlex Crichton-24/+47
We've seen quite a few issues with spurious illegal instructions getting executed on OSX on CI recently. For whatever reason `cc` itself is executing an illegal instruction and we're not really getting any other information about what's happening. Since we're already retrying the linker when it segfaults, let's just continue to retry everything and automatically reinvoke the linker when it fails with an illegal instruction.
2019-06-25Implement From<Local> for Place and PlaceBaseSantiago Pastorino-1/+1
2019-06-24Add mention of VS 2019 in link error output.CrLF0710-4/+8
2019-06-24Enable internal lints in bootstrapflip1995-1/+0
2019-06-22Deny explicit_outlives_requirements in the compilerMatthew Jasper-1/+0
2019-06-22Rollup merge of #61984 - ljedrz:more_node_id_pruning, r=ZoxcMazdak Farrokhzad-1/+1
More NodeId pruning Just another round of the `HirId`ification initiative. r? @Zoxc
2019-06-21Stabilize profile-guided optimization.Michael Woerister-4/+4
2019-06-20rename hir::map::get_by_hir_id to getljedrz-1/+1
2019-06-19Change `ByRef` to a struct variant to clarify its fields via namesOliver Scherer-2/+2
2019-06-19Remove the `AllocId` from `ByRef` valuesOliver Scherer-4/+4
`ByRef` const values have no identity beyond their value, we should not treat them as having identity. The `AllocId` often differed between equal constants, because of the way that the miri-engine evaluates constants.
2019-06-19Weave the alignment through `ByRef`Oliver Scherer-4/+5
2019-06-18Auto merge of #59625 - immunant:copy_variadics_typealias, r=eddybbors-27/+16
Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation We had to make some changes to expose `va_copy` and `va_end` directly to users (mainly for C2Rust, but not exclusively): - redefine the Rust variadic structures to more closely correspond to C: `VaList` now matches `va_list`, and `VaListImpl` matches `__va_list_tag` - add `Clone` for `VaListImpl` - add explicit `as_va_list()` conversion function from `VaListImpl` to `VaList` - add deref coercion from `VaList` to `VaListImpl` - add support for the `asmjs` target All these changes were needed for use cases like: ```Rust let mut ap2 = va_copy(ap); vprintf(fmt, ap2); va_end(&mut ap2); ```
2019-06-18Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-22/+22
2019-06-18rustc: reintroduce lifetime bounds where necessary.Eduard-Mihai Burtescu-2/+2
2019-06-18rustc: remove unused lifetimes.Eduard-Mihai Burtescu-1/+1
2019-06-18rustc: remove 'x: 'y bounds (except from comments/strings).Eduard-Mihai Burtescu-50/+50
2019-06-17Expose `VaListImpl` as the Rust equivalent of `__va_list_tag` and implement ↵Andrei Homescu-27/+16
Clone for it.
2019-06-17remove _by_hir_id if there is no NodeId counterpartljedrz-1/+1
2019-06-16Separate librustc_codegen_ssa modulechansuke-95/+94
2019-06-15Auto merge of #59752 - Zoxc:dylib-fix, r=alexcrichtonbors-15/+8
Limit dylib symbols This makes `windows-gnu` match the behavior of `windows-msvc`. It probably doesn't make sense to export these symbols on other platforms either.