about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2022-07-17Upgrade indexmap and thorin-dwp to use hashbrown 0.12Josh Stone-1/+1
This removes the last dependencies on hashbrown 0.11.
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-0/+16
2022-07-14Use constant eval to do strict validity checks5225225-5/+5
2022-07-14Auto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillotbors-25/+3
Stop keeping metadata in memory before writing it to disk Fixes #96358 I created this PR according with the instruction given in the issue except for the following points: - While the issue says "Write metadata into the temporary file in `encode_and_write_metadata` even if `!need_metadata_file`", I could not do that. That is because though I tried to do that and run `x.py test`, I got a lot of test failures as follows. <details> <summary>List of failed tests</summary> <pre> <code> failures: [ui] src/test/ui/json-multiple.rs [ui] src/test/ui/json-options.rs [ui] src/test/ui/rmeta/rmeta-rpass.rs [ui] src/test/ui/save-analysis/emit-notifications.rs [ui] src/test/ui/svh/changing-crates.rs [ui] src/test/ui/svh/svh-change-lit.rs [ui] src/test/ui/svh/svh-change-significant-cfg.rs [ui] src/test/ui/svh/svh-change-trait-bound.rs [ui] src/test/ui/svh/svh-change-type-arg.rs [ui] src/test/ui/svh/svh-change-type-ret.rs [ui] src/test/ui/svh/svh-change-type-static.rs [ui] src/test/ui/svh/svh-use-trait.rs test result: FAILED. 12915 passed; 12 failed; 100 ignored; 0 measured; 0 filtered out; finished in 71.41s Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu Build completed unsuccessfully in 0:01:58 </code> </pre> </details> - I could not resolve the extra tasks about `create_rmeta_file` and `create_compressed_metadata_file` for my lack of ability.
2022-07-14rustc: add ability to output regular LTO bitcode modulesZiv Dunkelman-0/+2
Adding the option to control from rustc CLI if the resulted ".o" bitcode module files are with thinLTO info or regular LTO info. Allows using "-lto-embed-bitcode=optimized" during linkage correctly. Signed-off-by: Ziv Dunkelman <ziv.dunkelman@nextsilicon.com>
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-44/+43
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPCbors-1/+1
Rollup of 5 pull requests Successful merges: - #98574 (Lower let-else in MIR) - #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside) - #99030 (diagnostics: error messages when struct literals fail to parse) - #99155 (Keep unstable target features for asm feature checking) - #99199 (Refactor: remove an unnecessary `span_to_snippet`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-13Rollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwcoDylan DPC-1/+1
Keep unstable target features for asm feature checking Inline assembly uses the target features to determine which registers are available on the current target. However it needs to be able to access unstable target features for this. Fixes #99071
2022-07-12add new rval, pull deref earlyouz-a-0/+6
2022-07-11Keep unstable target features for asm feature checkingAmanieu d'Antras-1/+1
Inline assembly uses the target features to determine which registers are available on the current target. However it needs to be able to access unstable target features for this. Fixes #99071
2022-07-09tweak names and output and blessRalf Jung-1/+1
2022-07-09review feedbackRalf Jung-1/+1
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).