about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2022-07-09don't allow ZST in ScalarIntRalf Jung-0/+5
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.
2022-07-08Auto merge of #98638 - bjorn3:less_string_interning, r=tmiaskobors-65/+58
Use less string interning This removes string interning in a couple of places where doing so won't result in perf improvements. I also switched one place to use pre-interned symbols.
2022-07-08Add `SourceScope::inlined_instance`Tomasz Miąsko-5/+2
2022-07-07Auto merge of #95573 - cjgillot:lower-query, r=michaelwoeristerbors-8/+12
Make lowering a query Split from https://github.com/rust-lang/rust/pull/88186. This PR refactors the relationship between lowering and the resolver outputs in order to make lowering itself a query. In a first part, lowering is changed to avoid modifying resolver outputs, by maintaining its own data structures for creating new `NodeId`s and so. Then, the `TyCtxt` is modified to allow creating new `LocalDefId`s from inside it. This is done by: - enclosing `Definitions` in a lock, so as to allow modification; - creating a query `register_def` whose purpose is to declare a `LocalDefId` to the query system. See `TyCtxt::create_def` and `TyCtxt::iter_local_def_id` for more detailed explanations of the design.
2022-07-07Auto merge of #99014 - Dylan-DPC:rollup-n84y0jk, r=Dylan-DPCbors-39/+71
Rollup of 8 pull requests Successful merges: - #96856 (Fix ProjectionElem validation) - #97711 (Improve soundness of rustc_arena) - #98507 (Finishing touches for `#[expect]` (RFC 2383)) - #98692 (rustdoc: Cleanup more FIXMEs) - #98901 (incr: cache dwarf objects in work products) - #98930 (Make MIR basic blocks field public) - #98973 (Remove (unused) inherent impl anchors) - #98981 ( Edit `rustc_mir_dataflow::framework` documentation ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-07Rollup merge of #98930 - tmiasko:pub-basic-blocks, r=oli-obkDylan DPC-1/+1
Make MIR basic blocks field public This makes it possible to mutably borrow different fields of the MIR body without resorting to methods like `basic_blocks_local_decls_mut_and_var_debug_info`. To preserve validity of control flow graph caches in the presence of modifications, a new struct `BasicBlocks` wraps together basic blocks and control flow graph caches. The `BasicBlocks` dereferences to `IndexVec<BasicBlock, BasicBlockData>`. On the other hand a mutable access requires explicit `as_mut()` call.
2022-07-07Rollup merge of #98901 - davidtwco:split-dwarf-incr-workproduct, ↵Dylan DPC-38/+70
r=michaelwoerister incr: cache dwarf objects in work products Cache DWARF objects alongside object files in work products when those exist so that DWARF object files are available for thorin in packed mode in incremental scenarios. r? `@michaelwoerister`
2022-07-07Auto merge of #98675 - eddyb:cg-array-literal, r=nikicbors-1/+6
rustc_codegen_ssa: use `project_index`, not `project_field`, for array literals. See https://github.com/rust-lang/rust/pull/98615#issuecomment-1170082774 for some context. In short, we were using `project_field` even for array `mir::Rvalue::Aggregate`s, which results in benchmarks like `deep-vector.rs` (and presumably also some real-world usecases?) being impacted by how we handle non-array aggregate fields. (This is a separate PR so that we can measure the perf effects in isolation) r? `@nikic`
2022-07-07Move `dominators` from Body to BasicBlocksTomasz Miąsko-1/+1
2022-07-06Allow to create definitions inside the query system.Camille GILLOT-8/+12
2022-07-06Rollup merge of #96935 - thomcc:atomicptr-strict-prov, r=dtolnayGuillaume Gomez-3/+1
Allow arithmetic and certain bitwise ops on AtomicPtr This is mainly to support migrating from `AtomicUsize`, for the strict provenance experiment. This is a pretty dubious set of APIs, but it should be sufficient to allow code that's using `AtomicUsize` to manipulate a tagged pointer atomically. It's under a new feature gate, `#![feature(strict_provenance_atomic_ptr)]`, but I'm not sure if it needs its own tracking issue. I'm happy to make one, but it's not clear that it's needed. I'm unsure if it needs changes in the various non-LLVM backends. Because we just cast things to integers anyway (and were already doing so), I doubt it. API change proposal: https://github.com/rust-lang/libs-team/issues/60 Fixes #95492
2022-07-06ssa: abort if dwarf packaging failsDavid Wood-0/+1
This should have been here from the start... oops. When `thorin` fails to package a DWARF package, that should fail compilation.
2022-07-06ssa: remove dwo of metadata and allocator moduleDavid Wood-14/+18
Compiling with `-Csplit-debuginfo=packed` was leaving behind `.dwo` files because either the metadata or allocator module contained a DWARF object which was not being removed by the `maybe_remove_temps_from_module` closure.
2022-07-06incr: cache dwarf objects in work productsDavid Wood-24/+51
Cache DWARF objects alongside object files in work products when those exist so that DWARF object files are available for thorin in packed mode in incremental scenarios. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06Update TypeVisitor pathsAlan Egerton-2/+2
2022-07-05Auto merge of #96862 - oli-obk:enum_cast_mir, r=RalfJungbors-75/+12
Change enum->int casts to not go through MIR casts. follow-up to https://github.com/rust-lang/rust/pull/96814 this simplifies all backends and even gives LLVM more information about the return value of `Rvalue::Discriminant`, enabling optimizations in more cases.
2022-07-05Prefer trace level instrumentation for the new noisy instrument attributesOli Scherer-2/+2
2022-07-05Add a helper method with an explicit name instead of hand rolling a match 3xOli Scherer-3/+3
2022-07-02import all necessary parts of rustc_metadata::fsYoshiki Matsuda-3/+4
2022-07-02fix a typoYoshiki Matsuda-1/+1
2022-07-02move emit_metadata to rustc_metadata::fsYoshiki Matsuda-29/+6
2022-07-02Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obkbors-0/+1
Enable MIR inlining Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.` #82280 has shown nice compile time wins could be obtained by enabling MIR inlining. Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed, except the interaction with polymorphization which is worked around specifically. I believe we can proceed with enabling MIR inlining in the near future (preferably just after beta branching, in case we discover new issues). Steps before merging: - [x] figure out the interaction with polymorphization; - [x] figure out how miri should deal with extern types; - [x] silence the extra arithmetic overflow warnings; - [x] remove the codegen fulfilment ICE; - [x] remove the type normalization ICEs while compiling nalgebra; - [ ] tweak the inlining threshold.
2022-07-01cleanup mir visitor for `rustc::pass_by_value`lcnr-3/+3
2022-07-01Allow arithmetic and certain bitwise ops on AtomicPtrThom Chiovoloni-3/+1
This is mainly to support migrating from AtomicUsize, for the strict provenance experiment. Fixes #95492
2022-06-30Recover when failing to normalize closure signature.Camille GILLOT-0/+1
2022-06-30Auto merge of #98377 - davidv1992:add-lifetimes-to-argument-temporaries, ↵bors-2/+16
r=oli-obk Added llvm lifetime annotations to function call argument temporaries. The goal of this change is to ensure that llvm will do stack slot optimization on these temporaries. This ensures that in code like: ```rust const A: [u8; 1024] = [0; 1024]; fn copy_const() { f(A); f(A); } ``` we only use 1024 bytes of stack space, instead of 2048 bytes. I am new to developing for the rust compiler, and as such not entirely sure, but I believe this should be sufficient to close #98156. Also, this does not contain a test case to ensure this keeps working, primarily because I am not sure how to go about testing this. I would love some suggestions as to how that could be approached.
2022-06-30Change enum->int casts to not go through MIR casts.Oli Scherer-70/+8
Instead we generate a discriminant rvalue and cast the result of that.
2022-06-29rustc_codegen_ssa: use `project_index`, not `project_field`, for array literals.Eduard-Mihai Burtescu-1/+6
2022-06-29Some tracing cleanupsOli Scherer-5/+4
2022-06-29Auto merge of #98558 - nnethercote:smallvec-1.8.1, r=lqdbors-1/+1
Update `smallvec` to 1.8.1. This pulls in https://github.com/servo/rust-smallvec/pull/282, which gives some small wins for rustc. r? `@lqd`
2022-06-29Rollup merge of #97423 - m-ou-se:memory-ordering-intrinsics, r=tmiaskoDylan DPC-32/+27
Simplify memory ordering intrinsics This changes the names of the atomic intrinsics to always fully include their memory ordering arguments. ```diff - atomic_cxchg + atomic_cxchg_seqcst_seqcst - atomic_cxchg_acqrel + atomic_cxchg_acqrel_release - atomic_cxchg_acqrel_failrelaxed + atomic_cxchg_acqrel_relaxed // And so on. ``` - `seqcst` is no longer implied - The failure ordering on chxchg is no longer implied in some cases, but now always explicitly part of the name. - `release` is no longer shortened to just `rel`. That was especially confusing, since `relaxed` also starts with `rel`. - `acquire` is no longer shortened to just `acq`, such that the names now all match the `std::sync::atomic::Ordering` variants exactly. - This now allows for more combinations on the compare exchange operations, such as `atomic_cxchg_acquire_release`, which is necessary for #68464. - This PR only exposes the new possibilities through unstable intrinsics, but not yet through the stable API. That's for [a separate PR](https://github.com/rust-lang/rust/pull/98383) that requires an FCP. Suffixes for operations with a single memory order: | Order | Before | After | |---------|--------------|------------| | Relaxed | `_relaxed` | `_relaxed` | | Acquire | `_acq` | `_acquire` | | Release | `_rel` | `_release` | | AcqRel | `_acqrel` | `_acqrel` | | SeqCst | (none) | `_seqcst` | Suffixes for compare-and-exchange operations with two memory orderings: | Success | Failure | Before | After | |---------|---------|--------------------------|--------------------| | Relaxed | Relaxed | `_relaxed` | `_relaxed_relaxed` | | Relaxed | Acquire | :x: | `_relaxed_acquire` | | Relaxed | SeqCst | :x: | `_relaxed_seqcst` | | Acquire | Relaxed | `_acq_failrelaxed` | `_acquire_relaxed` | | Acquire | Acquire | `_acq` | `_acquire_acquire` | | Acquire | SeqCst | :x: | `_acquire_seqcst` | | Release | Relaxed | `_rel` | `_release_relaxed` | | Release | Acquire | :x: | `_release_acquire` | | Release | SeqCst | :x: | `_release_seqcst` | | AcqRel | Relaxed | `_acqrel_failrelaxed` | `_acqrel_relaxed` | | AcqRel | Acquire | `_acqrel` | `_acqrel_acquire` | | AcqRel | SeqCst | :x: | `_acqrel_seqcst` | | SeqCst | Relaxed | `_failrelaxed` | `_seqcst_relaxed` | | SeqCst | Acquire | `_failacq` | `_seqcst_acquire` | | SeqCst | SeqCst | (none) | `_seqcst_seqcst` |
2022-06-28Reduce usage of Symbol in the linker codebjorn3-60/+55
Interning here doesn't save us anything. It rather costs a bit of time.
2022-06-28Avoid unnecessary string interning for const_strbjorn3-5/+3
2022-06-28Rename/restructure memory ordering intrinsics.Mara Bos-32/+27
2022-06-27Update `smallvec` to 1.8.1.Nicholas Nethercote-1/+1
This pulls in https://github.com/servo/rust-smallvec/pull/282, which gives some small wins for rustc.
2022-06-25Improved naming for copied constant arguments vector.David Venhoek-7/+7
2022-06-24Rollup merge of #98214 - petrochenkov:islike, r=compiler-errorsYuki Okushi-2/+2
rustc_target: Remove some redundant target properties `is_like_emscripten` is equivalent to `os == "emscripten"`, so it's removed. `is_like_fuchsia` is equivalent to `os == "fuchsia"`, so it's removed. `is_like_osx` also falls into the same category and is equivalent to `vendor == "apple"`, but it's commonly used so I kept it as is for now. `is_like_(solaris,windows,wasm)` are combinations of different operating systems or architectures (see compiler/rustc_target/src/spec/tests/tests_impl.rs) so they are also kept as is. I think `is_like_wasm` (and maybe `is_like_osx`) are sufficiently closed sets, so we can remove these fields as well and replace them with methods like `fn is_like_wasm() { arch == "wasm32" || arch == "wasm64" }`. On other hand, `is_like_solaris` and `is_like_windows` are sufficiently open and I can imagine custom targets introducing other values for `os`. This is kind of a gray area.
2022-06-24Rollup merge of #97633 - mkroening:object-osabi, r=petrochenkovYuki Okushi-6/+15
Session object: Set OS/ABI Closes https://github.com/rust-lang/rust/issues/97535. This depends on * https://github.com/gimli-rs/object/pull/438 This adapts LLVM's behavior of [`MCELFObjectTargetWriter::getOSABI`](https://github.com/llvm/llvm-project/blob/8c8a2679a20f621994fa904bcfc68775e7345edc/llvm/include/llvm/MC/MCELFObjectWriter.h#L72-L86).
2022-06-23Rollup merge of #98355 - hoodmane:emscripten-no-default, r=petrochenkovMichael Goulet-1/+1
Update no_default_libraries handling for emscripten target ```@sbc100``` says: > `-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]` is almost certainly wrong/out-of-date. This setting defaults to the empty list anyway these days so its redundant. Also we now support `-nodefaultlibs` so you can use that, as with other toolchains. https://github.com/rust-lang/rust/issues/98303#issuecomment-1162163684
2022-06-23Session object: Set OS/ABIMartin Kröning-2/+10
This adapts LLVM's behavior of MCELFObjectTargetWriter::getOSABI [1]. [1]: https://github.com/llvm/llvm-project/blob/8c8a2679a20f621994fa904bcfc68775e7345edc/llvm/include/llvm/MC/MCELFObjectWriter.h#L72-L86
2022-06-22Added llvm lifetime annotations to function call argument temporaries.David Venhoek-2/+16
The goal of this change is to ensure that llvm will do stack slot optimization on these temporaries. This ensures that in code like: ```rust const A: [u8; 1024] = [0; 1024]; fn copy_const() { f(A); f(A); } ``` we only use 1024 bytes of stack space, instead of 2048 bytes.
2022-06-21Update Emscripten's no_default_libraries handlingHood Chatham-1/+1
2022-06-21Auto merge of #98098 - bjorn3:archive_refactor, r=michaelwoeristerbors-24/+21
Remove the source archive functionality of ArchiveWriter We now build archives through strictly additive means rather than taking an existing archive and potentially substracting parts. This is simpler and makes it easier to swap out the archive writer in https://github.com/rust-lang/rust/pull/97485.
2022-06-21Auto merge of #95576 - DrMeepster:box_erasure, r=oli-obkbors-30/+8
Remove dereferencing of Box from codegen Through #94043, #94414, #94873, and #95328, I've been fixing issues caused by Box being treated like a pointer when it is not a pointer. However, these PRs just introduced special cases for Box. This PR removes those special cases and instead transforms a deref of Box into a deref of the pointer it contains. Hopefully, this is the end of the Box<T, A> ICEs.
2022-06-19Rollup merge of #98146 - hoodmane:remove-memory-init-flag, r=petrochenkovDylan DPC-2/+0
Remove --memory-init-file flag when linking with Emscripten This flag does nothing. It only applies when generating asmjs JavaScript. ``@sbc100``
2022-06-19Remove the source archive functionality of ArchiveWriterbjorn3-3/+3
We now build archives through strictly additive means rather than taking an existing archive and potentially substracting parts.
2022-06-19Fix "Remove src_files and remove_file"bjorn3-3/+4
2022-06-18ENH Move --memory-init-file flag from EmLinker to asmjs target specHood Chatham-2/+0
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-1/+1
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-18Rollup merge of #98150 - hoodmane:emscripten-g4, r=sbc100Yuki Okushi-2/+2
Emscripten target: replace -g4 with -g, and -g3 with --profiling-funcs Emscripten prints the following warning: ``` emcc: warning: please replace -g4 with -gsource-map [-Wdeprecated] ``` `@sbc100`