about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
AgeCommit message (Collapse)AuthorLines
2024-08-14Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errorsbors-3/+2
Shrink `TyKind::FnPtr`. By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI. r? `@compiler-errors`
2024-08-13stabilize `asm_const`Folkert-9/+6
2024-08-13Rollup merge of #128841 - lqd:rustc-args, r=onur-ozkanMatthias Krüger-2/+2
bootstrap: don't use rustflags for `--rustc-args` r? `@onur-ozkan` This is going to require a bit of context. https://github.com/rust-lang/rust/pull/47558 has added `--rustc-args` to `./x test` to allow passing flags when building `compiletest` tests. It was made specifically because using `RUSTFLAGS` would rebuild the compiler/stdlib, which would in turn require the flag you want to build tests with to successfully bootstrap. #113178 made the request that it also works for other tests and doctests. This is not trivial to support across the board for `library`/`compiler` unit-tests/doctests and across stages. This issue was closed in #113948 by using `RUSTFLAGS`, seemingly incorrectly since https://github.com/rust-lang/rust/pull/123489 fixed that part to make it work. Unfortunately #123489/#113948 have regressed the goals of `--rustc-args`: - now we can't use rustc args that don't bootstrap, to run the UI tests: we can't test incomplete features. The new trait solver doesn't bootstrap, in-progress borrowck/polonius changes don't bootstrap, some other features are similarly incomplete, etc. - using the flag now rebuilds everything from scratch: stage0 stdlib, stage1 compiler, stage1 stdlib. You don't need to re-do all this to compile UI tests, you only need the latter to run stdlib tests with a new flag, etc. This happens for contributors, but also on CI today. (Not to mention that in doing that it will rebuild things with flags that are not meant to be used, e.g. stdlib cfgs that don't exist in the compiler; or you could also imagine that this silently enables flags that were not meant to be enabled in this way). Since then, https://github.com/rust-lang/rust/pull/125011/commits/bd71c71ea04b4a4f954e579c2a6d44113274846a has started using it to test a stdlib feature, relying on the fact that it now rebuilds everything. So #125011 also regressed CI times more than necessary because it rebuilds everything instead of just stage 1 stdlib. It's not easy for me to know how to properly fix #113178 in bootstrap, but #113948/#123489 are not it since they regress the initial intent. I'd think bootstrap would have to know from the list of test targets that are passed that the `library` or `compiler` paths that are passed could require rebuilding these crates with different rustflags, probably also depending on stages. Therefore I would not be able to fix it, and will just try in this PR to unregress the situation to unblock the initial use-case. It seems miri now also uses `./x miri --rustc-args` in this incorrect meaning to rebuild the `library` paths they support to run with the new args. I've not made any bootstrap changes related to `./x miri` in this PR, so `--rustc-args` wouldn't work there anymore. I'd assume this would need to use rustflags again but I don't know how to make that work properly in bootstrap, hence opening as draft, so you can tell me how to do that. I assume we don't want to break their use-case again now that it exists, even though there are ways to use `./x test` to do exactly that. `RUSTFLAGS_NOT_BOOTSTRAP=flag ./x test library/std` is a way to run unit tests with a new flag without rebuilding everything, while with #123489 there is no way anymore to run tests with a flag that doesn't bootstrap. --- edit: after review, this PR: - renames `./x test --rustc-args` to `./x test --compiletest-rustc-args` as it only applies there, and cannot use rustflags for this purpose. - fixes the regression that using these args rebuilt everything from scratch - speeds up some CI jobs via the above point - removes `./x miri --rustc-args` as only library tests are supported, needs to rebuild libstd, and `./x miri --compiletest-rustc-args` wouldn't work since compiletests are not supported.
2024-08-13make the GCC backend compatible with vector shuffle indicesRalf Jung-14/+30
2024-08-13simd_shuffle intrinsic: allow argument to be passed as vector (not just as ↵Ralf Jung-7/+12
array)
2024-08-12rename `./x test`'s `--rustc-args` to `--compiletest-rustc-args`Rémy Rakic-2/+2
2024-08-12Rollup merge of #128537 - Jamesbarford:118980-const-vector, r=RalfJung,nikicGuillaume Gomez-0/+5
const vector passed through to codegen This allows constant vectors using a repr(simd) type to be propagated through to the backend by reusing the functionality used to do a similar thing for the simd_shuffle intrinsic #118209 r​? RalfJung
2024-08-12Rollup merge of #128149 - RalfJung:nontemporal_store, r=jieyouxu,Amanieu,JubileeGuillaume Gomez-0/+2
nontemporal_store: make sure that the intrinsic is truly just a hint The `!nontemporal` flag for stores in LLVM *sounds* like it is just a hint, but actually, it is not -- at least on x86, non-temporal stores need very special treatment by the programmer or else the Rust memory model breaks down. LLVM still treats these stores as-if they were normal stores for optimizations, which is [highly dubious](https://github.com/llvm/llvm-project/issues/64521). Let's avoid all that dubiousness by making our own non-temporal stores be truly just a hint, which is possible on some targets (e.g. ARM). On all other targets, non-temporal stores become regular stores. ~~Blocked on https://github.com/rust-lang/stdarch/pull/1541 propagating to the rustc repo, to make sure the `_mm_stream` intrinsics are unaffected by this change.~~ Fixes https://github.com/rust-lang/rust/issues/114582 Cc `@Amanieu` `@workingjubilee`
2024-08-10Fixes in various placesNadrieril-0/+1
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-3/+2
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-08-08Update compiler-builtins version to 0.1.118Guillaume Gomez-4/+2
2024-08-08const vector passed to codegenJames Barford-Evans-0/+5
2024-08-07Rollup merge of #128221 - calebzulawski:implied-target-features, r=AmanieuMatthias Krüger-4/+4
Add implied target features to target_feature attribute See [zulip](https://rust-lang.zulipchat.com/#narrow/stream/208962-t-libs.2Fstdarch/topic/Why.20would.20target-feature.20include.20implied.20features.3F) for some context. Adds implied target features, e.g. `#[target_feature(enable = "avx2")]` acts like `#[target_feature(enable = "avx2,avx,sse4.2,sse4.1...")]`. Fixes #128125, fixes #128426 The implied feature sets are taken from [the rust reference](https://doc.rust-lang.org/reference/attributes/codegen.html?highlight=target-fea#x86-or-x86_64), there are certainly more features and targets to add. Please feel free to reassign this to whoever should review it. r? ``@Amanieu``
2024-08-07Hide implicit target features from diagnostics when possibleCaleb Zulawski-1/+1
2024-08-07Refactor and fill out target feature listsCaleb Zulawski-3/+3
2024-08-05nontemporal_store: make sure that the intrinsic is truly just a hintRalf Jung-0/+2
2024-07-30Move computation of decorated names out of the create_dll_import_lib methodbjorn3-2/+1
2024-07-30Move temp file name generation out of the create_dll_import_lib methodbjorn3-4/+3
2024-07-29Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35bors-1/+8
Update compiler_builtins to 0.1.114 The `weak-intrinsics` feature was removed from compiler_builtins in https://github.com/rust-lang/compiler-builtins/pull/598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot. In https://github.com/rust-lang/compiler-builtins/pull/593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
2024-07-28Update compiler_builtins to 0.1.114Nicholas Bishop-1/+8
The `weak-intrinsics` feature was removed from compiler_builtins in https://github.com/rust-lang/compiler-builtins/pull/598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot. In https://github.com/rust-lang/compiler-builtins/pull/593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc. Also disable it for LLVM targets that don't support it.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-80/+69
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28stabilize `is_sorted`Slanterns-1/+1
2024-07-17Format cg_gcc with same formatting parametersGuillaume Gomez-54/+18
2024-07-17Align cg_gcc rustfmt.toml with rust'sGuillaume Gomez-0/+2
2024-07-16Rollup merge of #124033 - bjorn3:ar_archive_writer_0_3_0, r=davidtwcoTrevor Gross-2/+2
Sync ar_archive_writer to LLVM 18.1.3 From LLVM 15.0.0-rc3. This adds support for COFF archives containing Arm64EC object files and has various fixes for AIX big archive files.
2024-07-11Remove lang feature for type ascriptionMichael Goulet-1/+1
2024-07-10Update `Cargo.lock` and remove duplicated implGuillaume Gomez-10/+6
2024-07-10Merge commit '98ed962c7d3eebe12c97588e61245273d265e72f' into masterGuillaume Gomez-1137/+2684
2024-07-07Sync ar_archive_writer to LLVM 18.1.3bjorn3-2/+2
From LLVM 15.0.0-rc3. This adds support for COFF archives containing Arm64EC object files and has various fixes for AIX big archive files.
2024-07-04Auto merge of #123781 - RalfJung:miri-fn-identity, r=oli-obkbors-1/+1
Miri function identity hack: account for possible inlining Having a non-lifetime generic is not the only reason a function can be duplicated. Another possibility is that the function may be eligible for cross-crate inlining. So also take into account the inlining attribute in this Miri hack for function pointer identity. That said, `cross_crate_inlinable` will still sometimes return true even for `inline(never)` functions: - when they are `DefKind::Ctor(..) | DefKind::Closure` -- I assume those cannot be `InlineAttr::Never` anyway? - when `cross_crate_inline_threshold == InliningThreshold::Always` so maybe this is still not quite the right criterion to use for function pointer identity.
2024-07-02Fix spansMichael Goulet-2/+2
2024-07-02Give Instance::expect_resolve a spanMichael Goulet-0/+1
2024-07-02Miri function identity hack: account for possible inliningRalf Jung-1/+1
2024-06-21Remove type_i1 and type_struct from cg_ssabjorn3-25/+25
They are not representable by Cranelift
2024-06-21Remove check_overflow method from MiscMethodsbjorn3-8/+0
It can be retrieved from the Session too.
2024-06-21Remove const_bitcast from ConstMethodsbjorn3-13/+13
2024-06-20Add blank lines after module-level `//!` comments.Nicholas Nethercote-0/+1
Most modules have such a blank line, but some don't. Inserting the blank line makes it clearer that the `//!` comments are describing the entire module, rather than the `use` declaration(s) that immediately follows.
2024-06-18Remove redundant argument from `subdiagnostic` methodOli Scherer-1/+1
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-22/+20
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-10ScalarInt: size mismatches are a bug, do not delay the panicRalf Jung-1/+1
2024-06-01Uplift TypeRelation and RelateMichael Goulet-1/+1
2024-05-23Rollup merge of #125345 - durin42:thin-link-bitcode, r=bjorn3Guillaume Gomez-1/+5
rustc_codegen_llvm: add support for writing summary bitcode Typical uses of ThinLTO don't have any use for this as a standalone file, but distributed ThinLTO uses this to make the linker phase more efficient. With clang you'd do something like `clang -flto=thin -fthin-link-bitcode=foo.indexing.o -c foo.c` and then get both foo.o (full of bitcode) and foo.indexing.o (just the summary or index part of the bitcode). That's then usable by a two-stage linking process that's more friendly to distributed build systems like bazel, which is why I'm working on this area. I talked some to `@teresajohnson` about naming in this area, as things seem to be a little confused between various blog posts and build systems. "bitcode index" and "bitcode summary" tend to be a little too ambiguous, and she tends to use "thin link bitcode" and "minimized bitcode" (which matches the descriptions in LLVM). Since the clang option is thin-link-bitcode, I went with that to try and not add a new spelling in the world. Per `@dtolnay,` you can work around the lack of this by using `lld --thinlto-index-only` to do the indexing on regular .o files of bitcode, but that is a bit wasteful on actions when we already have all the information in rustc and could just write out the matching minimized bitcode. I didn't test that at all in our infrastructure, because by the time I learned that I already had this patch largely written.
2024-05-23rustc_codegen_gcc: fix changed method signatureAugie Fackler-1/+1
2024-05-22rustc_codegen_llvm: add support for writing summary bitcodeAugie Fackler-0/+4
Typical uses of ThinLTO don't have any use for this as a standalone file, but distributed ThinLTO uses this to make the linker phase more efficient. With clang you'd do something like `clang -flto=thin -fthin-link-bitcode=foo.indexing.o -c foo.c` and then get both foo.o (full of bitcode) and foo.indexing.o (just the summary or index part of the bitcode). That's then usable by a two-stage linking process that's more friendly to distributed build systems like bazel, which is why I'm working on this area. I talked some to @teresajohnson about naming in this area, as things seem to be a little confused between various blog posts and build systems. "bitcode index" and "bitcode summary" tend to be a little too ambiguous, and she tends to use "thin link bitcode" and "minimized bitcode" (which matches the descriptions in LLVM). Since the clang option is thin-link-bitcode, I went with that to try and not add a new spelling in the world. Per @dtolnay, you can work around the lack of this by using `lld --thinlto-index-only` to do the indexing on regular .o files of bitcode, but that is a bit wasteful on actions when we already have all the information in rustc and could just write out the matching minimized bitcode. I didn't test that at all in our infrastructure, because by the time I learned that I already had this patch largely written.
2024-05-22Stop using `to_hir_binop` in codegenScott McMurray-6/+7
2024-05-17Rename Unsafe to SafetySantiago Pastorino-8/+4
2024-05-10Auto merge of #124972 - matthiaskrgr:rollup-3fablim, r=matthiaskrgrbors-6/+3
Rollup of 5 pull requests Successful merges: - #124615 (coverage: Further simplify extraction of mapping info from MIR) - #124778 (Fix parse error message for meta items) - #124797 (Refactor float `Primitive`s to a separate `Float` type) - #124888 (Migrate `run-make/rustdoc-output-path` to rmake) - #124957 (Make `Ty::builtin_deref` just return a `Ty`) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-10Rollup merge of #124797 - beetrees:primitive-float, r=davidtwcoMatthias Krüger-6/+3
Refactor float `Primitive`s to a separate `Float` type Now there are 4 of them, it makes sense to refactor `F16`, `F32`, `F64` and `F128` out of `Primitive` and into a separate `Float` type (like integers already are). This allows patterns like `F16 | F32 | F64 | F128` to be simplified into `Float(_)`, and is consistent with `ty::FloatTy`. As a side effect, this PR also makes the `Ty::primitive_size` method work with `f16` and `f128`. Tracking issue: #116909 `@rustbot` label +F-f16_and_f128
2024-05-09codegen: memmove/memset cannot be non-temporalRalf Jung-9/+4
2024-05-08Simplify `use crate::rustc_foo::bar` occurrences.Nicholas Nethercote-4/+3
They can just be written as `use rustc_foo::bar`, which is far more standard. (I didn't even know that a `crate::` prefix was valid.)