about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2023-02-21Linker: use -z <params> instead of -z<params>Frank Denis-8/+8
The GNU linker accepts -z<params>, but this is undocumented, and not supported by other linkers. In particular, `zig cc`, when used as the C compiler/linker (e.g. when using `cargo-zigbuild`), will not accept this undocumented syntax. In `linker.rs`, both syntaxes are also used inconsistently. The Go compiler used to have the same issue, but fixed it: https://github.com/golang/go/commit/38607c553878da21b5042e63997ecb3b7201e684
2023-02-20Fix metadata encoding and decoding to use the right lengthRune Tynan-1/+6
2023-02-20Try adding metadata length prefix, and obey it while decodingRune Tynan-0/+1
2023-02-20Move the resolver into a queryOli Scherer-0/+1
2023-02-19Auto merge of #107921 - cjgillot:codegen-overflow-check, r=tmiaskobors-39/+7
Make codegen choose whether to emit overflow checks ConstProp and DataflowConstProp currently have a specific code path not to propagate constants when they overflow. This is meant to have the correct behaviour when inlining from a crate with overflow checks (like `core`) into a crate compiled without. This PR shifts the behaviour change to the `Assert(Overflow*)` MIR terminators: if the crate is compiled without overflow checks, just skip emitting the assertions. This is already what happens with `OverflowNeg`. This allows ConstProp and DataflowConstProp to transform `CheckedBinaryOp(Add, u8::MAX, 1)` into `const (0, true)`, and let codegen ignore the `true`. The interpreter is modified to conform to this behaviour. Fixes #35310
2023-02-18Stop implementing _with_overflow intrinsics in codegen backends.Camille GILLOT-25/+0
2023-02-18Remove special case in rvalue codegen.Camille GILLOT-12/+0
2023-02-18Make name more explicit.Camille GILLOT-2/+2
2023-02-18Comment codegen optimization.Camille GILLOT-0/+3
2023-02-18Remove outdated comment.Camille GILLOT-3/+0
2023-02-18Adapt interpreter.Camille GILLOT-10/+6
2023-02-18Do not codegen overflow check when not required.Camille GILLOT-2/+11
2023-02-18Emit the right types for vtable pointers when dropping dyn*Michael Goulet-80/+78
2023-02-18Use inttoptr to support usize as dyn* value, use pointercast to make sure ↵Michael Goulet-0/+8
pointers are compatible
2023-02-18make first component of dyn* use pointer layout+type, and adjust DynStar commentRalf Jung-8/+1
2023-02-18Auto merge of #99679 - repnop:kernel-address-sanitizer, r=cuviperbors-1/+2
Add `kernel-address` sanitizer support for freestanding targets This PR adds support for KASan (kernel address sanitizer) instrumentation in freestanding targets. I included the minimal set of `x86_64-unknown-none`, `riscv64{imac, gc}-unknown-none-elf`, and `aarch64-unknown-none` but there's likely other targets it can be added to. (`linux_kernel_base.rs`?) KASan uses the address sanitizer attributes but has the `CompileKernel` parameter set to `true` in the pass creation.
2023-02-17Rollup merge of #108149 - tshepang:typo, r=Dylan-DPCMatthias Krüger-1/+1
typo
2023-02-17typoTshepang Mbambo-1/+1
2023-02-17Rollup merge of #108086 - alexcrichton:wasm-relaxed-simd-feature, r=eholkMatthias Krüger-0/+1
wasm: Register the `relaxed-simd` target feature This WebAssembly proposal is likely to reach stage 4 soon so this starts the support in Rust for the proposal by adding a target feature that can be enabled via attributes for the stdarch project to bind the intrinsics.
2023-02-16Replace some `then`s with some `then_some`sMaybe Waffle-1/+1
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-8/+5
2023-02-15Auto merge of #108012 - compiler-errors:issue-107999, r=oli-obkbors-2/+8
Don't ICE in `might_permit_raw_init` if reference is polymorphic Emitting optimized MIR for a polymorphic function may require computing layout of a type that isn't (yet) known. This happens in the instcombine pass, for example. Let's fail gracefully in that condition. cc `@saethlin` fixes #107999
2023-02-15Auto merge of #108006 - cjgillot:def-impl, r=oli-obkbors-41/+39
Avoid accessing HIR when it can be avoided Experiment to see if it helps some incremental cases. Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged. r? `@ghost`
2023-02-15wasm: Register the `relaxed-simd` target featureAlex Crichton-0/+1
This WebAssembly proposal is likely to reach stage 4 soon so this starts the support in Rust for the proposal by adding a target feature that can be enabled via attributes for the stdarch project to bind the intrinsics.
2023-02-14Add `kernel-address` sanitizer support for freestanding targetsWesley Norris-1/+2
2023-02-14Make permit_uninit/zero_init fallibleMichael Goulet-2/+8
2023-02-14Do not fetch HIR to check target features.Camille GILLOT-8/+5
2023-02-14Do not fetch HIR to compute symbols.Camille GILLOT-33/+34
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-8/+17
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-1/+1
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-4/+3
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-12Auto merge of #105601 - BelovDV:change-rlib-with-not-stable, r=petrochenkovbors-96/+41
Enable new rlib in non stable cases If bundled static library uses cfg (unstable) or whole-archive (wasn't supported) bundled libs are packed even without packed_bundled_libs. r? `@petrochenkov`
2023-02-10remove redundant clonesMatthias Krüger-1/+1
2023-02-10[link] enable packed bundled lib in non stable casesDaniil Belov-96/+41
2023-02-06remove unused importsklensy-1/+0
2023-02-05Remove misleading target feature aliasesCaleb Zulawski-3/+0
2023-02-04Auto merge of #107267 - cjgillot:keep-aggregate, r=oli-obkbors-11/+12
Do not deaggregate MIR This turns out to simplify a lot of things. I haven't checked the consequences for miri yet. cc `@JakobDegen` r? `@oli-obk`
2023-02-02Codegen SetDiscriminant after field assignment.Camille GILLOT-15/+11
This matches the order in which deaggregation was performed.
2023-02-02Interpret aggregates.Camille GILLOT-0/+5
2023-02-01ast: Optimize list and value extraction primitives for attributesVadim Petrochenkov-50/+38
It's not necessary to convert the whole attribute into a meta item to extract something specific
2023-02-01Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwcobors-47/+3
Strengthen validation of FFI attributes Previously, `codegen_attrs` validated the attributes `#[ffi_pure]`, `#[ffi_const]`, and `#[ffi_returns_twice]` to make sure that they were only used on foreign functions. However, this validation was insufficient in two ways: 1. `codegen_attrs` only sees items for which code must be generated, so it was unable to raise errors when the attribute was incorrectly applied to macros and the like. 2. the validation code only checked that the item with the attr was foreign, but not that it was a foreign function, allowing these attributes to be applied to foreign statics as well. This PR moves the validation to `check_attr`, which sees all items. It additionally changes the validation to ensure that the attribute's target is `Target::ForeignFunction`, only allowing the attributes on foreign functions and not foreign statics. Because these attributes are unstable, there is no risk for backwards compatibility. The changes also ending up making the code much easier to read. This PR is best reviewed commit by commit. Additionally, I was considering moving the tests to the `attribute` subdirectory, to get them out of the general UI directory. I could do that as part of this PR or a follow-up, as the reviewer prefers. CC: #58328, #58329
2023-02-01Stabilize `#![feature(target_feature_11)]`Léo Lanteri Thauvin-29/+18
2023-02-01Stabilize cmpxchg16b_target_featureNugine-2/+1
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-2/+7
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-29Auto merge of #107435 - matthiaskrgr:rollup-if5h6yu, r=matthiaskrgrbors-11/+22
Rollup of 8 pull requests Successful merges: - #106618 (Disable `linux_ext` in wasm32 and fortanix rustdoc builds.) - #107097 (Fix def-use dominance check) - #107154 (library/std/sys_common: Define MIN_ALIGN for m68k-unknown-linux-gnu) - #107397 (Gracefully exit if --keep-stage flag is used on a clean source tree) - #107401 (remove the usize field from CandidateSource::AliasBound) - #107413 (make more pleasant to read) - #107422 (Also erase substs for new infcx in pin move error) - #107425 (Check for missing space between fat arrow and range pattern) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-29Rollup merge of #107097 - tmiasko:ssa, r=cjgillotMatthias Krüger-11/+22
Fix def-use dominance check A definition does not dominate a use in the same statement. For example in MIR generated for compound assignment x += a (when overflow checks are disabled).
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-0/+1
Use stable metric for const eval limit instead of current terminator-based logic This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only. The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made). Also see: #103877
2023-01-28Auto merge of #107360 - bjorn3:fix_thin_archive_reading, r=wesleywiserbors-34/+36
Fix thin archive reading This includes a revert of https://github.com/rust-lang/rust/pull/105221 to restore fat archive reading with LlvmArchiveBuilder. Should fix #107162, #107334 and https://github.com/google/shaderc-rs/issues/133
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-0/+1
2023-01-27Auto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnrbors-4/+4
Switch to `EarlyBinder` for `fn_sig` query Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78). Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`. r? `@lcnr`