about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift
AgeCommit message (Collapse)AuthorLines
2023-12-19Merge commit '3a9bf729322fb5035518f99b9d76a742bf7c124e' into ↵bjorn3-117/+225
sync_cg_clif-2023-12-19
2023-12-18Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.Nicholas Nethercote-2/+2
2023-12-18Rename many `DiagCtxt` arguments.Nicholas Nethercote-2/+2
2023-12-18Rename `Session::span_diagnostic` as `Session::dcx`.Nicholas Nethercote-1/+1
2023-12-18Rename `EarlyErrorHandler` as `EarlyDiagCtxt`.Nicholas Nethercote-4/+3
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-1/+1
2023-12-14update use of feature flagslcnr-1/+1
2023-12-13Auto merge of #118534 - RalfJung:extern-type-size-of-val, r=WaffleLapkinbors-60/+0
codegen: panic when trying to compute size/align of extern type The alignment is also computed when accessing a field of extern type at non-zero offset, so we also panic in that case. Previously `size_of_val` worked because the code path there assumed that "thin pointer" means "sized". But that's not true any more with extern types. The returned size and align are just blatantly wrong, so it seems better to panic than returning wrong results. We use a non-unwinding panic since code probably does not expect size_of_val to panic.
2023-12-12remove a cranelift test that doesn't make sense any moreRalf Jung-60/+0
2023-12-11Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=davidtwcobors-1/+1
Add lint against ambiguous wide pointer comparisons This PR is the resolution of https://github.com/rust-lang/rust/issues/106447 decided in https://github.com/rust-lang/rust/issues/117717 by T-lang. ## `ambiguous_wide_pointer_comparisons` *warn-by-default* The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands. ### Example ```rust let ab = (A, B); let a = &ab.0 as *const dyn T; let b = &ab.1 as *const dyn T; let _ = a == b; ``` ### Explanation The comparison includes metadata which may not be expected. ------- This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one. ~~One thing: is the current naming right? `invalid` seems a bit too much.~~ Fixes https://github.com/rust-lang/rust/issues/117717
2023-12-10remove redundant importssurechen-13/+2
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-09Add simd_masked_{load,store} platform-intrinsicsJakub Okoński-1/+51
This maps to the LLVM intrinsics: llvm.masked.load and llvm.masked.store
2023-12-07Auto merge of #118324 - RalfJung:ctfe-read-only-pointers, r=saethlinbors-2/+4
compile-time evaluation: detect writes through immutable pointers This has two motivations: - it unblocks https://github.com/rust-lang/rust/pull/116745 (and therefore takes a big step towards `const_mut_refs` stabilization), because we can now detect if the memory that we find in `const` can be interned as "immutable" - it would detect the UB that was uncovered in https://github.com/rust-lang/rust/pull/117905, which was caused by accidental stabilization of `copy` functions in `const` that can only be called with UB When UB is detected, we emit a future-compat warn-by-default lint. This is not a breaking change, so completely in line with [the const-UB RFC](https://rust-lang.github.io/rfcs/3016-const-ub.html), meaning we don't need t-lang FCP here. I made the lint immediately show up for dependencies since it is nearly impossible to even trigger this lint without `const_mut_refs` -- the accidentally stabilized `copy` functions are the only way this can happen, so the crates that popped up in #117905 are the only causes of such UB (in the code that crater covers), and the three cases of UB that we know about have all been fixed in their respective crates already. The way this is implemented is by making use of the fact that our interpreter is already generic over the notion of provenance. For CTFE we now use the new `CtfeProvenance` type which is conceptually an `AllocId` plus a boolean `immutable` flag (but packed for a more efficient representation). This means we can mark a pointer as immutable when it is created as a shared reference. The flag will be propagated to all pointers derived from this one. We can then check the immutable flag on each write to reject writes through immutable pointers. I just hope perf works out.
2023-12-07ctfe interpreter: extend provenance so that it can track whether a pointer ↵Ralf Jung-2/+4
is immutable
2023-12-06Adjust tests for newly added ambiguous_wide_pointer_comparisons lintUrgau-1/+1
2023-12-04Give `Handler::fatal` and `Session::fatal` the same return type.Nicholas Nethercote-1/+1
Currently, `Handler::fatal` returns `FatalError`. But `Session::fatal` returns `!`, because it calls `Handler::fatal` and then calls `raise` on the result. This inconsistency is unfortunate. This commit changes `Handler::fatal` to do the `raise` itself, changing its return type to `!`. This is safe because there are only two calls to `Handler::fatal`, one in `rustc_session` and one in `rustc_codegen_cranelift`, and they both call `raise` on the result. `HandlerInner::fatal` still returns `FatalError`, so I renamed it `fatal_no_raise` to emphasise the return type difference.
2023-11-25Auto merge of #118279 - bjorn3:sync_cg_clif-2023-11-25, r=bjorn3bors-71/+452
Subtree sync for rustc_codegen_cranelift The main highlights this time are implementing a bunch of new vendor intrinsics and fixing some existing ones. And fixing polymorphization for coroutines. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2023-11-25Merge commit '710c67909d034e1c663174a016ca82b95c2d6c12' into ↵bjorn3-71/+452
sync_cg_clif-2023-11-25
2023-11-24Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)`David Tolnay-2/+2
2023-11-23Fix fn_sig_for_fn_abi and the coroutine transform for generatorsbjorn3-1/+50
There were three issues previously: * The self argument was pinned, despite Iterator::next taking an unpinned mutable reference. * A resume argument was passed, despite Iterator::next not having one. * The return value was CoroutineState<Item, ()> rather than Option<Item> While these things just so happened to work with the LLVM backend, cg_clif does much stricter checks when trying to assign a value to a place. In addition it can't handle the mismatch between the amount of arguments specified by the FnAbi and the FnSig.
2023-11-16Merge commit 'def04540a4e2541b995195c752c751295606a388' into ↵bjorn3-192/+473
sync_cg_clif-2023-11-16
2023-11-15Add check-cfg to craneliftMark Rousskov-0/+2
2023-11-10Merge commit 'c84d1871dc4456539b7b578830268ab3539915d0' into ↵bjorn3-67/+961
sync_cg_clif-2023-11-10
2023-11-04Remove support for compiler plugins.Nicholas Nethercote-1/+0
They've been deprecated for four years. This commit includes the following changes. - It eliminates the `rustc_plugin_impl` crate. - It changes the language used for lints in `compiler/rustc_driver_impl/src/lib.rs` and `compiler/rustc_lint/src/context.rs`. External lints are now called "loaded" lints, rather than "plugins" to avoid confusion with the old plugins. This only has a tiny effect on the output of `-W help`. - E0457 and E0498 are no longer used. - E0463 is narrowed, now only relating to unfound crates, not plugins. - The `plugin` feature was moved from "active" to "removed". - It removes the entire plugins chapter from the unstable book. - It removes quite a few tests, mostly all of those in `tests/ui-fulldeps/plugin/`. Closes #29597.
2023-10-31Support enum variants in offset_of!George Bateman-1/+1
2023-10-30Rollup merge of #117317 - RalfJung:track-caller, r=oli-obkGuillaume Gomez-41/+5
share some track_caller logic between interpret and codegen Also move the code that implements the track_caller intrinsics out of the core interpreter engine -- it's just a helper creating a const-allocation, doesn't need to be part of the interpreter core.
2023-10-29Merge commit 'dde58803fd6cbb270c7a437f36a8a3a29fbef679' into ↵bjorn3-334/+100
sync_cg_clif-2023-10-29
2023-10-28Auto merge of #81746 - bjorn3:cg_clif_rustup_component, r=Mark-Simulacrumbors-34/+34
Distribute cg_clif as rustup component on the nightly channel This makes it possible to use cg_clif using: ```bash $ rustup component add rustc-codegen-cranelift-preview --toolchain nightly $ RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build ``` cc https://github.com/rust-lang/compiler-team/issues/405. r? `@Mark-Simulacrum`
2023-10-28share the track_caller handling within a mir::BodyRalf Jung-32/+5
2023-10-28interpret: call caller_location logic the same way codegen does, and share ↵Ralf Jung-10/+1
some code
2023-10-28Auto merge of #116609 - eduardosm:bump-stdarch, r=workingjubileebors-35/+0
Bump stdarch submodule and remove special handling for LLVM intrinsics that are no longer needed Bumps stdarch to pull https://github.com/rust-lang/stdarch/pull/1477, which reimplemented some functions with portable SIMD intrinsics instead of arch specific LLVM intrinsics. Handling of those LLVM intrinsics is removed from cranelift codegen and miri. cc `@RalfJung` `@bjorn3`
2023-10-27Update target-lexicon to 0.12.12bjorn3-2/+2
This adds support for loongarch and a bunch of other targets
2023-10-27Update Cranelift to 0.101.2 and disable host-arch feature of cranelift-codegenbjorn3-32/+32
This ensures that cg_clif can be built for targets that aren't natively supported by Cranelift. It will not be possible to compile for the host in this case, but cross-compilation will still be possible. We won't distribute cg_clif as rustup component for any targets that aren't natively supported by Cranelift, but will still build it if codegen-backends lists "cranelift".
2023-10-24Merge commit '93a5433f17ab5ed48cc88f1e69b0713b16183373' into ↵bjorn3-138/+260
sync_cg_clif-2023-10-24
2023-10-21Merge commit 'c07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa' into ↵bjorn3-493/+163
sync_cg_clif-2023-10-21
2023-10-20s/generator/coroutine/Oli Scherer-2/+2
2023-10-20s/Generator/Coroutine/Oli Scherer-4/+4
2023-10-17[RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopesUrgau-5/+30
2023-10-16docs: add Rust logo to more compiler cratesMichael Howell-0/+3
c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.
2023-10-12Remove from cranelift codegen LLVM intrinsics that are no longer neededEduardo Sánchez Muñoz-35/+0
2023-10-09Fix review commentsbjorn3-1/+1
2023-10-09Remove cgu_reuse_tracker from Sessionbjorn3-32/+36
This removes a bit of global mutable state
2023-10-09Reuse determine_cgu_reuse from cg_ssa in cg_clifbjorn3-29/+1
2023-10-09Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into ↵bjorn3-709/+1205
sync_cg_clif-2023-10-09
2023-10-08Auto merge of #116487 - tamird:avoid-unwrap-absolute, r=bjorn3bors-1/+1
compiler: env/path handling fixes Please see individual commits. r? `@bjorn3` cf. #116426
2023-10-06Rollup merge of #116277 - RalfJung:post-mono, r=oli-obkJubilee-11/+0
dont call mir.post_mono_checks in codegen It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-06compiler: always use var_os("RUST_BACKTRACE")Tamir Duberstein-1/+1
There are 3 instances of var(...) and 3 instances of var_os(...); the latter avoids an appearance of unhandled error, so use it everywhere.
2023-10-05Rollup merge of #116223 - catandcoder:master, r=cjgillotJubilee-1/+1
Fix misuses of a vs an Fixes the misuse of "a" vs "an", according to English grammatical expectations and using https://www.a-or-an.com/
2023-10-04Fix misuses of a vs ancui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-03Auto merge of #115025 - ouz-a:ouz_testing, r=lcnrbors-0/+11
Make subtyping explicit in MIR This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205 Addresses https://github.com/rust-lang/rust/issues/112651 r? `@lcnr`