about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2018-09-26add -Z emit-stack-sizesJorge Aparicio-1/+4
2018-09-23Auto merge of #54380 - RalfJung:miri-snapshot, r=eddybbors-1/+1
move CTFE engine snapshot state out of miri engine into CTFE machine instance It still lives in the `interpret` module as it needs access to all sorts of private stuff. Also rename a thing to make @eddyb happy :D The goal was not to change any behavior.
2018-09-23Auto merge of #54325 - michaelwoerister:incr-thinlto-tests, r=alexcrichtonbors-26/+24
incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. This adds some tests specifically targeted at incremental ThinLTO, plus the infrastructure for tracking the kind of cache hit/miss we had for a given CGU. @alexcrichton, let me know if you can think of any more tests to add. ThinLTO works rather reliably for small functions, so we should be able to test it in a robust way. I think after this lands it might time for a "Help us test incremental ThinLTO" post on irlo. r? @alexcrichton
2018-09-22Auto merge of #53508 - japaric:maybe-uninit, r=RalfJungbors-6/+54
Implement `MaybeUninit` This PR: - Adds `MaybeUninit` (see #53491) to `{core,std}::mem`. - Makes `mem::{uninitialized,zeroed}` panic when they are used to instantiate an uninhabited type. - Does *not* deprecate `mem::{uninitialized,zeroed}` just yet. As per https://github.com/rust-lang/rust/issues/53491#issuecomment-414147666, we should not deprecate them until `MaybeUninit` is stabilized. - It replaces uses of `mem::{uninitialized,zeroed}` in core and alloc with `MaybeUninit`. There are still several instances of `mem::{uninitialized,zeroed}` in `std` that *this* PR doesn't address. r? @RalfJung cc @eddyb you may want to look at the new panicking logic
2018-09-22Auto merge of #54188 - lqd:fallout-53695, r=nikomatsakisbors-1/+1
NLL: disallow creation of immediately unusable variables Fix #53695 Original description follows ---- This WIP PR is for discussing the impact of fixing #53695 by injecting a fake read in let patterns. (Travis will fail, at least the `mir-opt` suite is failing in its current state)
2018-09-22move our check to reuse a previous computationJorge Aparicio-20/+21
2018-09-22improve panic messageJorge Aparicio-8/+6
2018-09-22use is_uninhabited in more placesJorge Aparicio-6/+6
2018-09-22adapt to change in Session APIJorge Aparicio-1/+1
2018-09-22panic when instantiating an uninhabited type via mem::{uninitialized,zeroed}Jorge Aparicio-0/+49
2018-09-20Rollup merge of #54258 - alexcrichton:lld-fatal-warnings, r=eddybkennytm-0/+4
Enable fatal warnings for the wasm32 linker Historically LLD has emitted warnings for various reasons but all the bugs have since been fixed (yay!) and by enabling fatal warnings we should be able to head off bugs like #53390 sooner.
2018-09-20Rollup merge of #54233 - irinagpopa:llvm-3.9, r=tromeykennytm-16/+4
Remove LLVM 3.9 workaround.
2018-09-20rename evaluator -> interpreter to make eddyb happyRalf Jung-1/+1
2018-09-18incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to ↵Michael Woerister-26/+24
test incremental ThinLTO.
2018-09-18Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake readRemy Rakic-1/+1
2018-09-18Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.Nicholas Nethercote-10/+10
Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-09-15Enable fatal warnings for the wasm32 linkerAlex Crichton-0/+4
Historically LLD has emitted warnings for various reasons but all the bugs have since been fixed (yay!) and by enabling fatal warnings we should be able to head off bugs like #53390 sooner.
2018-09-14Remove LLVM 3.9 workaround.Unknown-16/+4
2018-09-14Rollup merge of #54095 - kenta7777:kenta7777#53719, r=davidtwcokennytm-4/+4
Rename all mentions of `nil` to `unit` Fixes #53719. Renamed keywords nil to unit.
2018-09-14Rollup merge of #53950 - michaelwoerister:more-lto-cli, r=alexcrichtonkennytm-8/+4
Allow for opting out of ThinLTO and clean up LTO related cli flag handling. It turns out that there currently is no way to explicitly disable ThinLTO (except for the nightly-only `-Zthinlto` flag). This PR extends `-C lto` to take `yes` and `no` in addition to `thin` and `fat`. It should be backwards compatible. It also cleans up how LTO mode selection is handled. Note that merging the PR in the current state would make the new values for `-C lto` available on the stable channel. I think that would be fine but maybe some team should vote on it.
2018-09-12Merge branch 'master' into kenta7777#53719kenta7777-6/+19
2018-09-12Auto merge of #53793 - toidiu:ak-stabalize, r=nikomatsakisbors-1/+0
stabilize outlives requirements https://github.com/rust-lang/rust/issues/44493 r? @nikomatsakis
2018-09-12Rollup merge of #52514 - DiamondLovesYou:amdgpu-fixes, r=eddybkennytm-5/+18
Fix a few AMDGPU related issues * AMDGPU ignores `noinline` and sadly doesn't clear the attribute when it slaps `alwaysinline` on everything, * an AMDGPU related load bit range metadata assertion, * I didn't enable the `amdgpu` component in the `librustc_llvm` build script, * Add AMDGPU call abi info.
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-1/+0
Co-authored-by: nikomatsakis
2018-09-11renamed is_nil to is_unitkenta7777-3/+3
2018-09-11Revert "renamed is_nil to is_unit"kenta7777-3/+3
This reverts commit 6f685ffad42a2d12dd1fad5ccb0471e7fa260826.
2018-09-10add the `AscribeUserType` statement kindNiko Matsakis-1/+1
Make it have the semantics of subtype.
2018-09-10renamed mk_nil to mk_unitkenta7777-1/+1
2018-09-10renamed is_nil to is_unitkenta7777-3/+3
2018-09-09Auto merge of #53998 - eddyb:issue-53728, r=oli-obkbors-12/+19
rustc_codegen_llvm: don't assume offsets are always aligned. Fixes #53728 by taking into account not just overall type alignment and the field's alignment when determining whether a field is aligned or not ("packed"), but also the field's offset within the type. Previously, rustc assumed that the offset was always at least as aligned as `min(struct.align, field.align)`. However, there's no real reason to have that assumption, and it obviously can't always be true after we implement `#[repr(align(N), pack(K))]`. There's also a case today where that assumption is not true, involving niche discriminants in enums: Suppose that we have the code in #53728: ```Rust #[repr(u16)] enum DeviceKind { Nil = 0, } #[repr(packed)] struct DeviceInfo { endianness: u8, device_kind: DeviceKind, } struct Wrapper { device_info: DeviceInfo, data: u32 } ``` Observe the layout of `Option<Wrapper>`. It has an alignment of 4 because of the `u32`. `device_info.device_kind` is a good niche field to use, which means the enum ends up with this layout: ``` size = 8 align = 4 fields = [ { offset=1, type=u16 } // discriminant, .<Some>.device_info.device_kind ] ``` And here we have an discriminant with alignment 2 (`u16`) but offset 1.
2018-09-08Auto merge of #53705 - ms2300:tmp, r=oli-obkbors-1/+1
#53576 Renaming TyAnon -> TyOpaque Fixes #53576
2018-09-07make field always private, add `From` implsNiko Matsakis-3/+1
2018-09-06rustc_codegen_llvm: don't assume offsets are always aligned.Eduard-Mihai Burtescu-12/+19
2018-09-05Auto merge of #53962 - michaelwoerister:close-thinlto-file-descriptors, ↵bors-4/+4
r=alexcrichton ThinLTO: Don't keep files open after mmaping them. Fixes #53947. r? @alexcrichton
2018-09-05Changing TyAnon -> TyOpaque and relevant functionsms2300-1/+1
2018-09-05Auto merge of #53878 - alexcrichton:wasm-atomics-feature, r=eddybbors-4/+14
rustc: Prepare the `atomics` feature for wasm This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-09-05ThinLTO: Don't keep files open after mmaping them (because it's not needed).Michael Woerister-4/+4
2018-09-05Allow for opting out of ThinLTO and clean up LTO related cli flag handling.Michael Woerister-8/+4
2018-09-03Auto merge of #53926 - japaric:arm-features, r=alexcrichtonbors-0/+4
whitelist some ARM features required for rust-lang-nursery/stdsimd#557 r? @gnzlbg or @alexcrichton
2018-09-03whitelist some ARM featuresJorge Aparicio-0/+4
2018-09-03incr.ThinLTO: Do some cleanup and add some logging.Michael Woerister-62/+57
2018-08-31rustc: Prepare the `atomics` feature for wasmAlex Crichton-4/+14
This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-08-31Always add all modules to the global ThinLTO module analysis when compiling ↵Michael Woerister-359/+159
incrementally.
2018-08-31Support local ThinLTO with incremental compilation.Michael Woerister-256/+608
2018-08-31Make codegen not be a query (since it's not a real query anyway).Michael Woerister-13/+22
2018-08-31Persist ThinLTO import data in incr. comp. session directory.Michael Woerister-4/+137
2018-08-31Provide a way of accessing the ThinLTO module import map in rustc.Michael Woerister-0/+9
2018-08-30Rollup merge of #53472 - eddyb:fx-pls, r=pnkfelixPietro Albini-4/+4
Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc. Most of the compiler uses the `Fx` hasher but some places ended up with the default one.
2018-08-29Auto merge of #53642 - alexcrichton:fix-target-cpu-native, r=arielb1bors-3/+25
Fix warnings about the `native` target-cpu This fixes a regression from #53031 where specifying `-C target-cpu=native` is printing a lot of warnings from LLVM about `native` being an unknown CPU. It turns out that `native` is indeed an unknown CPU and we have to perform a mapping to an actual CPU name, but this mapping is only performed in one location rather than all locations we inform LLVM about the target CPU. This commit centralizes the mapping of `native` to LLVM's value of the native CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's never `native`. Closes #53322
2018-08-29Auto merge of #53671 - RalfJung:miri-refactor, r=oli-obkbors-4/+4
Miri engine cleanup * Unify the two maps in memory to store the allocation and its kind together. * Share the handling of statics between CTFE and miri: The miri engine always uses "lazy" `AllocType::Static` when encountering a static. Acessing that static invokes CTFE (no matter the machine). The machine only has any influence when writing to a static, which CTFE outright rejects (but miri makes a copy-on-write). * Add an `AllocId` to by-ref consts so miri can use them as operands without making copies. * Move responsibilities around for the `eval_fn_call` machine hook: The hook just has to find the MIR (or entirely take care of everything); pushing the new stack frame is taken care of by the miri engine. * Expose the intrinsics and lang items implemented by CTFE so miri does not have to reimplement them. * Allow Machine to hook into foreign statics (used by miri to get rid of some other hacks). * Clean up function calling. * Switch const sanity check to work on operands, not mplaces. * Move const_eval out of rustc_mir::interpret, to make sure that it does not access private implementation details. In particular, we can finally make `eval_operand` take `&self`. :-) Should be merged after https://github.com/rust-lang/rust/pull/53609, across which I will rebase.