about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2025-07-03Remove unnecessary check for fat LTObjorn3-1/+1
2025-07-03Move run_fat_lto call into execute_fat_lto_work_itembjorn3-32/+36
This will allow merging all fat LTO steps together. In addition it reduces the amount of work done on the coordinator thread without jobserver token.
2025-07-03Pass in autodiff items when starting the coordinator threadbjorn3-19/+6
As opposed to sending a message to the coordinator thread.
2025-07-03Split generate_lto_work between fat and thin-LTO casesbjorn3-49/+63
2025-07-03Fat LTO always produces a single object file, so -Zcombine-cgu has no effectbjorn3-1/+3
2025-07-03Move dcx creation into WriteBackendMethods::codegenbjorn3-6/+2
2025-07-03Remove LtoModuleCodegenbjorn3-76/+38
Most uses of it either contain a fat or thin lto module. Only WorkItem::LTO could contain both, but splitting that enum variant doesn't complicate things much.
2025-07-03Rollup merge of #142876 - JonathanBrouwer:target_feature_parser, r=oli-obkJana Dönszelmann-134/+122
Port `#[target_feature]` to new attribute parsing infrastructure Ports `target_feature` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? ``@jdonszelmann``
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-7/+7
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-7/+7
2025-07-03Port `#[target_feature]` to the new attribute parsing infrastructureJonathan Brouwer-134/+122
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-02Rollup merge of #143194 - folkertdev:fix-single-element-simd-bitcast, ↵Matthias Krüger-8/+2
r=workingjubilee fix bitcast of single-element SIMD vectors in effect this reverts https://github.com/rust-lang/rust/pull/142768 and adds additional tests. That PR relaxed the conditions on an early return in an incorrect way that would create broken LLVM IR. https://godbolt.org/z/PaaGWTv5a ```rust #![feature(repr_simd)] #[repr(simd)] #[derive(Clone, Copy)] struct S([i64; 1]); #[no_mangle] pub extern "C" fn single_element_simd(b: S) -> i64 { unsafe { std::mem::transmute(b) } } ``` at the time of writing generates this LLVM IR, where the type of the return is different from the function's return type. ```llvm define noundef i64 ``````@single_element_simd(<1`````` x i64> %b) unnamed_addr { start: ret <1 x i64> %b } ``` The test output is actually the same for the existing tests, showing that the change didn't actually matter for any tested behavior. It is probably a bit faster to do the early return, but, well, it's incorrect in general. zullip thread: [#t-compiler > Is transmuting a &#96;T&#96; to &#96;Tx1&#96; (one-element SIMD vector) UB?](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Is.20transmuting.20a.20.60T.60.20to.20.60Tx1.60.20.28one-element.20SIMD.20vector.29.20UB.3F/with/526262799) cc ``````@sayantn`````` r? ``````@scottmcm``````
2025-07-01Remove support for dyn*Michael Goulet-99/+0
2025-07-01Auto merge of #143013 - bjorn3:split_exported_symbols, r=oli-obkbors-9/+27
Split exported_symbols for generic and non-generic symbols This reduces metadata decoder overhead during the monomorphization collector.
2025-07-01Rollup merge of #143156 - folkertdev:fn-align-inherit-from-trait, ↵Matthias Krüger-9/+22
r=workingjubilee inherit `#[align]` from trait method prototypes ````@workingjubilee```` this seems straightforward enough. Now that we're planning to make `-Cmin-function-alignment` a target modifier, I don't think there are any cross-crate complications here? ````@Jules-Bertholet```` is this the behavior you had in mind? In particular the inheritance of the attribute of a default impl is maybe a bit unintuitive at first? (but I think it's ok if that behavior is explicitly documented). r? ghost
2025-06-30Auto merge of #143233 - dianqk:rollup-lcx3278, r=dianqkbors-14/+7
Rollup of 14 pull requests Successful merges: - rust-lang/rust#142429 (`tests/ui`: A New Order [13/N]) - rust-lang/rust#142514 (Miri: handling of SNaN inputs in `f*::pow` operations) - rust-lang/rust#143066 (Use let chains in the new solver) - rust-lang/rust#143090 (Workaround for memory unsafety in third party DLLs) - rust-lang/rust#143118 (`tests/ui`: A New Order [15/N]) - rust-lang/rust#143159 (Do not freshen `ReError`) - rust-lang/rust#143168 (`tests/ui`: A New Order [16/N]) - rust-lang/rust#143176 (fix typos and improve clarity in documentation) - rust-lang/rust#143187 (Add my work email to mailmap) - rust-lang/rust#143190 (Use the `new` method for `BasicBlockData` and `Statement`) - rust-lang/rust#143195 (`tests/ui`: A New Order [17/N]) - rust-lang/rust#143196 (Port #[link_section] to the new attribute parsing infrastructure) - rust-lang/rust#143199 (Re-disable `tests/run-make/short-ice` on Windows MSVC again) - rust-lang/rust#143219 (Show auto trait and blanket impls for `!`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-30Rollup merge of #143196 - Periodic1911:link_section, r=oli-obkdianqk-10/+3
Port #[link_section] to the new attribute parsing infrastructure Ports link_section to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@oli-obk` cc `@JonathanBrouwer` `@jdonszelmann`
2025-06-30fix bitcast of single-element SIMD vectorsFolkert de Vries-8/+2
2025-06-30Require either wrapping nullary intrinsincs in const blocks or explicitly ↵Oli Scherer-1/+22
deciding not to
2025-06-30Stop backends from needing to support nullary intrinsicsOli Scherer-4/+0
2025-06-29inherit `#[align]` from trait method prototypesFolkert de Vries-9/+22
2025-06-29Port #[link_section] to the new attribute parsing infrastructureAnne Stijns-10/+3
2025-06-29mir: Add a `new` method to `statement`dianqk-4/+4
Avoid introducing a large number of changes when adding optional initialization fields.
2025-06-29Rollup merge of #143138 - JonathanBrouwer:link_name_parser, r=jdonszelmannMatthias Krüger-1/+1
Port `#[link_name]` to the new attribute parsing infrastructure Ports `link_name` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@jdonszelmann`
2025-06-29Rollup merge of #143088 - firefighterduck:improve-doc-discr-tag, r=RalfJungMatthias Krüger-10/+1
Improve documentation of `TagEncoding` This PR is follow-up from the [discussion here](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20VariantId.3DDiscriminant.20when.20tag.20is.20niche.20encoded.3F/with/524384295). It aims at making the `TagEncoding` documentation less ambiguous and more detailed with references to relevant implementation sides. It especially clears up the ambiguous use of discriminant/variant index, which sparked the discussion referenced above. PS: While working with layout data, I somehow ended up looking at the docs for `FakeBorrowKind` and noticed that the one example was not in a doc comment. I hope that this is minor enough of a fix for it to be okay in this otherwise unrelated PR.
2025-06-29Rollup merge of #142641 - bjorn3:proc_macro_symbols_o, r=jieyouxuMatthias Krüger-2/+7
Generate symbols.o for proc-macros too To ensure used statics are functioning correctly for proc-macros too.
2025-06-28move discr=varid check to layout_sanity_checkFlorian Sextl-10/+1
2025-06-28Port `#[link_name]` to the new attribute parsing infrastructureJonathan Brouwer-1/+1
Co-authored-by: Anne Stijns <anstijns@gmail.com> Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-28Auto merge of #141759 - 1c3t3a:discriminants-query, r=saethlinbors-0/+6
Insert checks for enum discriminants when debug assertions are enabled Similar to the existing null-pointer and alignment checks, this checks for valid enum discriminants on creation of enums through unsafe transmutes. Essentially this sanitizes patterns like the following: ```rust let val: MyEnum = unsafe { std::mem::transmute<u32, MyEnum>(42) }; ``` An extension of this check will be done in a follow-up that explicitly sanitizes for extern enum values that come into Rust from e.g. C/C++. This check is similar to Miri's capabilities of checking for valid construction of enum values. This PR is inspired by saethlin@'s PR https://github.com/rust-lang/rust/pull/104862. Thank you so much for keeping this code up and the detailed comments! I also pair-programmed large parts of this together with vabr-g@. r? `@saethlin`
2025-06-27Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkovMatthias Krüger-21/+33
Reduce special casing for the panic runtime See the individual commits for more info.
2025-06-27Rollup merge of #143020 - RalfJung:codegen_fn_attrs, r=oli-obkGuillaume Gomez-1/+3
codegen_fn_attrs: make comment more precise Follow-up to https://github.com/rust-lang/rust/pull/142854. r? ``@oli-obk`` or ``@workingjubilee``
2025-06-27Generate symbols.o for proc-macros toobjorn3-2/+7
To ensure used statics are functioning correctly for proc-macros too.
2025-06-27Update commentsbjorn3-5/+5
2025-06-27Insert checks for enum discriminants when debug assertions are enabledBastian Kersting-0/+6
Similar to the existing nullpointer and alignment checks, this checks for valid enum discriminants on creation of enums through unsafe transmutes. Essentially this sanitizes patterns like the following: ```rust let val: MyEnum = unsafe { std::mem::transmute<u32, MyEnum>(42) }; ``` An extension of this check will be done in a follow-up that explicitly sanitizes for extern enum values that come into Rust from e.g. C/C++. This check is similar to Miri's capabilities of checking for valid construction of enum values. This PR is inspired by saethlin@'s PR https://github.com/rust-lang/rust/pull/104862. Thank you so much for keeping this code up and the detailed comments! I also pair-programmed large parts of this together with vabr-g@.
2025-06-27Split exported_symbols for generic and non-generic symbolsbjorn3-9/+27
This reduces metadata decoder overhead during the monomorphization collector.
2025-06-27Port `#[used]` to new attribute parsing infrastructureJonathan Brouwer-48/+5
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27codegen_fn_attrs: make comment more preciseRalf Jung-1/+3
2025-06-26Move mixed export_name/no_mangle check to check_attr.rs and improve the errorJonathan Brouwer-71/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-26Port `#[export_name]` to the new attribute parsing infrastructureJonathan Brouwer-20/+4
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-25Auto merge of #142879 - Mark-Simulacrum:opt-cleanup, r=WaffleLapkinbors-1/+1
Remove dead instructions in terminate blocks Terminate blocks look pretty in the IR I've looked at, so no actual perf delta from this. But it seems reasonable to note produce unused IR.
2025-06-24Rollup merge of #142825 - jdonszelmann:track-caller, r=oli-obkJubilee-28/+26
Port `#[track_caller]` to the new attribute system r? ``@oli-obk`` depends on https://github.com/rust-lang/rust/pull/142493 Closes rust-lang/rust#142783 (didn't add a test for this, this situation should simply never come up again, the code was simply wrong. lmk if I should add it, but it won't test something very useful)
2025-06-24Rollup merge of #142768 - scottmcm:avoid-unneeded-bitcast, r=WaffleLapkinJubilee-2/+8
Avoid a bitcast FFI call in transmuting For things that only change the valid ranges, we can just return the input, rather than making the `LLVMBuildBitCast` call and having *it* then do nothing. I tried to tweak this a bit more and broke stuff, so I also added some extra tests for that as we apparently didn't have coverage.
2025-06-24Auto merge of #142979 - matthiaskrgr:rollup-szqah4e, r=matthiaskrgrbors-7/+7
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142645 (Also emit suggestions for usages in the `non_upper_case_globals` lint) - rust-lang/rust#142657 (mbe: Clean up code with non-optional `NonterminalKind`) - rust-lang/rust#142799 (rustc_session: Add a structure for keeping both explicit and default sysroots) - rust-lang/rust#142805 (Emit a single error when importing a path with `_`) - rust-lang/rust#142882 (Lazy init diagnostics-only local_names in borrowck) - rust-lang/rust#142883 (Add impl_trait_in_bindings tests from rust-lang/rust#61773) - rust-lang/rust#142943 (Don't include current rustc version string in feature removed help) - rust-lang/rust#142965 ([RTE-497] Ignore `c-link-to-rust-va-list-fn` test on SGX platform) - rust-lang/rust#142972 (Add a missing mailmap entry) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-24Rewrite #[track_caller]Jana Dönszelmann-28/+26
2025-06-24Fix LTO for internalizing rustc_std_internal_symbol symbolsbjorn3-0/+15
2025-06-24Add all rustc_std_internal_symbol to symbols.objorn3-21/+18
rustc_std_internal_symbol is meant to call functions from crates where there is no direct dependency on said crate. As they either have to be added to symbols.o or rustc has to introduce an implicit dependency on them to avoid linker errors. The latter is done for some things like the panic runtime, but adding these symbols to symbols.o allows removing those implicit dependencies.
2025-06-24Rollup merge of #142742 - dpaoliello:arm64eclinking, r=bjorn3Guillaume Gomez-49/+141
[win][aarch64] Fix linking statics on Arm64EC, take 2 Arm64EC builds recently started to fail due to the linker not finding a symbol: ``` symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol) C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals ``` It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it. The fix is to have Rust not prefix statics with `#` when importing. Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them. Fixes rust-lang/rust#138541 Resurrects rust-lang/rust#140176 now that rust-lang/rust#141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`. r? ``@wesleywiser`` CC ``@bjorn3``
2025-06-24rustc_session: Add a structure for keeping both explicit and default sysrootsVadim Petrochenkov-7/+7
Also avoid creating and cloning sysroot unnecessarily.
2025-06-23Rollup merge of #142923 - folkertdev:min-function-alignment-no-attributes, ↵Jubilee-6/+4
r=workingjubilee fix `-Zmin-function-alignment` on functions without attributes tracking issue: https://github.com/rust-lang/rust/issues/82232 related: https://github.com/rust-lang/rust/pull/142854 The minimum function alignment was skipped on functions without attributes (because the logic was in a loop that only runs if there is at least one attribute). The underlying reason we didn't catch this before is that in our testing we generally apply `#[no_mangle]` to functions that are tested. I've added a test now that deliberately has no attributes. r? `@workingjubilee`
2025-06-23[Arm64EC] Only decorate functions with `#`Daniel Paoliello-49/+141