about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2018-11-15Rollup merge of #55901 - euclio:speling, r=petrochenkovPietro Albini-1/+1
fix various typos in doc comments
2018-11-15Rollup merge of #55785 - stjepang:unsized-drop-forget, r=alexcrichtonPietro Albini-1/+1
Add mem::forget_unsized() for forgetting unsized values ~~Allows passing values of `T: ?Sized` types to `mem::drop` and `mem::forget`.~~ Adds `mem::forget_unsized()` that accepts `T: ?Sized`. I had to revert the PR that removed the `forget` intrinsic and replaced it with `ManuallyDrop`: https://github.com/rust-lang/rust/pull/40559 We can't use `ManuallyDrop::new()` here because it needs `T: Sized` and we don't have support for unsized return values yet (will we ever?). r? @eddyb
2018-11-15Auto merge of #55716 - RalfJung:escape-to-raw, r=oli-obkbors-1/+2
Add escape-to-raw MIR statement Add a new MIR "ghost state statement": Escaping a ptr to permit raw accesses. ~~This includes #55549, [click here](https://github.com/RalfJung/rust/compare/miri-visitor...RalfJung:escape-to-raw) for just the new commits.~~
2018-11-13Auto merge of #55912 - kennytm:rollup, r=kennytmbors-1/+1
Rollup of 20 pull requests Successful merges: - #55136 (Remove short doc where it starts with a codeblock) - #55711 (Format BtreeMap::range_mut example) - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters) - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err) - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to) - #55805 (Move `static_assert!` into librustc_data_structures) - #55837 (Make PhantomData #[structural_match]) - #55840 (Fix TLS errors when downloading stage0) - #55843 (add FromIterator<A> to Box<[A]>) - #55858 (Small fixes on code blocks in rustdoc) - #55863 (Fix a typo in std::panic) - #55870 (Fix typos.) - #55874 (string: Add documentation for `From` impls) - #55879 (save-analysis: Don't panic for macro-generated use globs) - #55882 (Reference count `crate_inherent_impls`s return value.) - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra) - #55889 (global allocators: add a few comments) - #55896 (Document optimizations enabled by FusedIterator) - #55905 (Change `Lit::short_name` to `Lit::literal_name`.) - #55908 (Fix their/there grammar nit)
2018-11-13fix various typos in doc commentsAndy Russell-2/+2
2018-11-13Rollup merge of #55870 - waywardmonkeys:typo-fixes, r=wesleywiserkennytm-1/+1
Fix typos.
2018-11-12Use type safe `VariantIdx` instead of `usize` everywhereOliver Scherer-19/+21
2018-11-12Auto merge of #55701 - tromey:ice-fix, r=matthewjasperbors-4/+4
Fix emission of niche-filling discriminant values Bug #55606 points out a regression introduced by #54004; namely that an assertion can erroneously fire when a niche-filling discriminant value is emitted. This fixes the bug by removing the assertion, and furthermore by arranging for the discriminant value to be masked according to the size of the niche. This makes handling the discriminant a bit simpler for debuggers. The test case is from Jonathan Turner. Closes #55606
2018-11-11Auto merge of #55698 - nikic:remove-llvm-4-support, r=alexcrichtonbors-59/+26
Remove support for building against LLVM 4 With emscripten removed in #55626, we no longer need to support building against LLVM 4.
2018-11-11Fix typos.Bruce Mitchener-1/+1
2018-11-11Auto merge of #54993 - TimNN:pda-tdl, r=eddybbors-3/+13
Support for the program data address space option of LLVM's Target Datalayout This was introduced recently (specifically, for AVR, cc @dylanmckay). (I came up with this when attempting to run [avr-rust](https://github.com/avr-rust/rust) rebased on the latest [rust-lang](https://github.com/rust-lang/rust) commits. If this requires a different design, some additional discussions, or is not something to pursue right now, I'd be happy to close this PR). Note that this somewhat overlaps with @DiamondLovesYou's #51576, I think, although the implementation here is significantly simpler: Since the address space applies to _all_ program data, we can just check the pointee's type whenever we create an LLVM pointer type. If it is a function we use the program data address space; if not we use the default address space. cc @eddyb, who has been reviewing #51576 Ref: https://llvm.org/docs/LangRef.html#data-layout
2018-11-10Auto merge of #54864 - ljedrz:cleanup_codegen_llvm_back, r=Mark-Simulacrumbors-139/+110
Cleanup codegen_llvm/back - improve allocations - use `Cow<'static, str>` where applicable - use `to_owned` instead of `to_string` with string literals - remove a redundant `continue` - possible minor speedup in logic - use `mem::replace` instead of `swap` where more concise - remove `'static` from consts - improve common patterns - remove explicit `return`s - whitespace & formatting fixes
2018-11-10Auto merge of #55650 - nikic:funnel-shift, r=nagisabors-5/+45
Implement rotate using funnel shift on LLVM >= 7 Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore. Fixes #52457.
2018-11-10codegen_llvm_back: simplify a conversion to charljedrz-1/+1
2018-11-10codegen_llvm_back: remove a redundant continueljedrz-1/+0
2018-11-10codegen_llvm_back: possible minor speedup in logicljedrz-1/+1
2018-11-10codegen_llvm_back: remove 'static from constsljedrz-3/+3
2018-11-10codegen_llvm_back: use to_owned instead of to_string with string literalsljedrz-4/+4
2018-11-10codegen_llvm_back: improve common patternsljedrz-46/+23
2018-11-10codegen_llvm_back: remove explicit returnsljedrz-12/+15
2018-11-10codegen_llvm_back: use Cow<'static, str> where applicableljedrz-22/+21
2018-11-10codegen_llvm_back: whitespace & formatting fixesljedrz-50/+43
2018-11-10Auto merge of #55626 - nikic:update-emscripten, r=alexcrichtonbors-1/+2
Update emscripten This updates emscripten to 1.38.15, which is based on LLVM 6.0.1 and would allow us to drop code for handling LLVM 4. The main issue I ran into is that exporting statics through `EXPORTED_FUNCTIONS` no longer works. As far as I understand exporting non-functions doesn't really make sense under emscripten anyway, so I've modified the symbol export code to not even try. Closes #52323.
2018-11-08Rollup merge of #55633 - nikic:memcpy-align, r=nagisaMark Rousskov-47/+60
Support memcpy/memmove with differing src/dst alignment If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version. Fixes #49740.
2018-11-08Support for the program data address space optionTim Neumann-3/+13
of LLVM's Target Datalayout. https://llvm.org/docs/LangRef.html#data-layout
2018-11-08Disable wasm32 features on emscriptenNikita Popov-1/+2
These are only supported by the native wasm32 backend.
2018-11-08Allow unsized types in mem::drop and mem::forgetStjepan Glavina-1/+1
2018-11-07no more action on ref or cast, but add new MIR statement for escaping a ptr ↵Ralf Jung-1/+2
to raw
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-2/+2
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-07Rollup merge of #55609 - nikic:fix-51947, r=nagisakennytm-2/+13
Run name-anon-globals after LTO passes as well If we're going to emit bitcode (through ThinLTOBuffer), then we need to ensure that anon globals are named. This was already done after optimization passes, but also has to happen after LTO passes, as we always emit the final result in a ThinLTO-compatible manner. I added the test as `run-make`. The important bit is that we emit bitcode in some way (e.g. `--crate-type rlib` or `--emit=llvm-bc`). Please tell me if there is a better way to test for that. Fixes #51947
2018-11-06refactor: use shorthand fieldsteresy-2/+2
2018-11-06Run name-anon-globals after LTO passes as wellNikita Popov-2/+13
If we're going to emit bitcode (through ThinLTOBuffer), then we need to ensure that anon globals are named. This was already done after optimization passes, but also has to happen after LTO passes, as we always emit the final result in a ThinLTO-compatible manner. Fixes #51947.
2018-11-05Auto merge of #55410 - nagisa:atomic-align, r=pnkfelixbors-13/+10
Correct alignment of atomic types and (re)add Atomic{I,U}128 This is a updated https://github.com/rust-lang/rust/pull/53514 to also make atomic types `repr(C)` as per comment in https://github.com/rust-lang/rust/pull/53514#issuecomment-431042767. Fixes #39590 Closes #53514 r? @pnkfelix
2018-11-05Fix emission of niche-filling discriminant valuesTom Tromey-4/+4
Bug #55606 points out a regression introduced by #54004; namely that an assertion can erroneously fire when a niche-filling discriminant value is emitted. This fixes the bug by removing the assertion, and furthermore by arranging for the discriminant value to be masked according to the size of the niche. This makes handling the discriminant a bit simpler for debuggers. The test case is from Jonathan Turner. Closes #55606
2018-11-05Remove support for building against LLVM 4Nikita Popov-59/+26
With emscripten removed in #55626, we no longer need to support building against LLVM 4.
2018-11-05Auto merge of #55593 - nikic:remove-llvm-4-checks, r=rkruppebors-32/+6
Remove checks for LLVM < 4.0 While we still have to support LLVM 4.0 for Emscripten, we can drop checks for LLVM >= 4.0 and < 4.0.
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-9/+9
2018-11-04Support memcpy/memmove with differing src/dst alignmentNikita Popov-47/+60
If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version.
2018-11-04Auto merge of #55349 - bjorn3:rustc_mir_collect_and_partition_mono_items, ↵bors-1873/+20
r=oli-obk Move collect_and_partition_mono_items to rustc_mir Most of the logic of it is inside rustc_mir anyway. Also removes the single function crate rustc_metadata_utils. Based on #55225
2018-11-03Implement rotate using funnel shift on LLVM >= 7Nikita Popov-5/+45
Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore.
2018-11-03Move collect_and_partition_mono_items to rustc_mirbjorn3-153/+6
2018-11-03Move cg_llvm::back::linker to cg_utilsbjorn3-1720/+14
2018-11-03Auto merge of #55330 - scalexm:bound-ty, r=nikomatsakisbors-3/+4
Add support for bound types This PR may have some slight performance impacts, I don't know how hot is the code I touched. Also, this breaks clippy and miri. r? @nikomatsakis
2018-11-03Rename `Binder::no_late_bound_regions` to `Binder::no_bound_vars`scalexm-1/+1
2018-11-03Shift both late bound regions and bound typesscalexm-2/+2
2018-11-03Move `BoundTy` to `ty::TyKind`scalexm-0/+1
2018-11-03Auto merge of #55238 - alexcrichton:rm-jemalloc, r=estebankbors-10/+104
Remove the `alloc_jemalloc` crate This commit removes the `alloc_jemalloc` crate from the standard library and all related configuration. We will no longer be shipping this unstable crate. Rationale for this is provided on https://github.com/rust-lang/rust/issues/36963 and the many linked issues, but I can inline rationale here if desired! We currently rely on jemalloc for increased perf in the Rust compiler, however. [This perf run shows](https://perf.rust-lang.org/compare.html?start=74ff7dcb1388e60a613cd6050bcd372a3cc4998b&end=7e7928dc0340d79b404e93f0c79eb4b946c1d669&stat=wall-time) that if we switch to glibc 2.23's allocator that it's slower than jemalloc across many benchmarks. [This perf run, however](https://perf.rust-lang.org/compare.html?start=22cc2ae8057d14e980b7c784e1eb2eee26b59e7d&end=10c95ccfa7a7adc12f4e608621ca29f9b98eed29), shows that if we use `jemalloc-sys` from crates.io then rustc actually gets faster across all benchmarks! (presumably because it has a more recent version of jemalloc than our submodule). As a result, it's expected that this doesn't regress any code (as it's just removing an unstable crate) and it should actually improve rustc performance because it updates jemalloc. Closes #36963
2018-11-03Auto merge of #54383 - mikeyhew:custom-receivers-object-safety, r=nikomatsakisbors-19/+79
Take 2: Implement object-safety and dynamic dispatch for arbitrary_self_types This replaces #50173. Over the months that that PR was open, we made a lot of changes to the way this was going to be implemented, and the long, meandering comment thread and commit history would have been confusing to people reading it in the future. So I decided to package everything up with new, straighforward commits and open a new PR. Here are the main points. Please read the commit messages for details. - To simplify codegen, we only support receivers that have the ABI of a pointer. That means they are builtin pointer types, or newtypes thereof. - We introduce a new trait: `DispatchFromDyn<T>`, similar to `CoerceUnsized<T>`. `DispatchFromDyn` has extra requirements that `CoerceUnsized` does not: when you implement `DispatchFromDyn` for a struct, there cannot be any extra fields besides the field being coerced and `PhantomData` fields. This ensures that the struct's ABI is the same as a pointer. - For a method's receiver (e.g. `self: Rc<Self>`) to be object-safe, it needs to have the following property: - let `DynReceiver` be the receiver when `Self = dyn Trait` - let `ConcreteReceiver` be the receiver when `Self = T`, where `T` is some unknown `Sized` type that implements `Trait`, and is the erased type of the trait object. - `ConcreteReceiver` must implement `DispatchFromDyn<DynReceiver>` In the case of `Rc<Self>`, this requires `Rc<T>: DispatchFromDyn<Rc<dyn Trait>>` These rules are explained more thoroughly in the doc comment on `receiver_is_dispatchable` in object_safety.rs. r? @nikomatsakis and @eddyb cc @arielb1 @cramertj @withoutboats Special thanks to @nikomatsakis for getting me un-stuck when implementing the object-safety checks, and @eddyb for helping with the codegen parts. EDIT 2018-11-01: updated because CoerceSized has been replaced with DispatchFromDyn
2018-11-02Auto merge of #55087 - levex:e0669-improve-span, r=nagisabors-8/+5
rustc: improve E0669 span E0669 refers to an operand that cannot be coerced into a single LLVM value, unfortunately right now this uses the Span for the entire inline assembly statement, which is less than ideal. This commit preserves the Span from HIR, which lets us emit the error using the Span for the operand itself in MIR. r? @nagisa cc/ @parched
2018-11-02rustc: Wait for all codegen threads to exitAlex Crichton-10/+104
This commit updates rustc to wait for all codegen threads to exit before allowing the main thread to exit. This is a stab in the dark to fix the mysterious segfaults appearing on #55238, and hopefully we'll see whether this actually fixes things in practice...