summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src
AgeCommit message (Collapse)AuthorLines
2024-03-16Merge commit '4cf4ffc6ba514f171b3f52d1c731063e4fc45be3' into ↵bjorn3-13/+29
sync_cg_clif-2024-03-16
2024-03-14Rollup merge of #122287 - RalfJung:simd-static-assert, r=pnkfelixMatthias Krüger-1/+1
add test ensuring simd codegen checks don't run when a static assertion failed stdarch relies on this to ensure that SIMD indices are in bounds. I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. `@oli-obk` `@bjorn3` do you have any idea?
2024-03-10add comments explaining where post-mono const eval errors abort compilationRalf Jung-1/+1
2024-03-10use Instance::expect_resolve() instead of unwraping Instance::resolve()Ralf Jung-6/+2
2024-03-10Auto merge of #121662 - saethlin:precondition-unification, r=RalfJungbors-1/+1
Distinguish between library and lang UB in assert_unsafe_precondition As described in https://github.com/rust-lang/rust/pull/121583#issuecomment-1963168186, `assert_unsafe_precondition` now explicitly distinguishes between language UB (conditions we explicitly optimize on) and library UB (things we document you shouldn't do, and maybe some library internals assume you don't do). `debug_assert_nounwind` was originally added to avoid the "only at runtime" aspect of `assert_unsafe_precondition`. Since then the difference between the macros has gotten muddied. This totally revamps the situation. Now _all_ preconditions shall be checked with `assert_unsafe_precondition`. If you have a precondition that's only checkable at runtime, do a `const_eval_select` hack, as done in this PR. r? RalfJung
2024-03-08Distinguish between library and lang UB in assert_unsafe_preconditionBen Kimock-1/+1
2024-03-08Merge commit '54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba' into ↵bjorn3-8/+205
sync_cg_clif-2024-03-08
2024-03-08Rollup merge of #119365 - nbdd0121:asm-goto, r=AmanieuMatthias Krüger-3/+19
Add asm goto support to `asm!` Tracking issue: #119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2024-03-05only set noalias on Box with the global allocatorRalf Jung-4/+0
2024-03-04Add a scheme for moving away from `extern "rust-intrinsic"` entirelyOli Scherer-1/+11
2024-02-28Add `f16` and `f128` to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`Trevor Gross-0/+4
Make changes necessary to support these types in the compiler.
2024-02-27Auto merge of #121635 - 823984418:remove_archive_builder_lifetime_a, ↵bors-1/+1
r=nnethercote Remove useless lifetime of ArchiveBuilder `trait ArchiveBuilder<'a>` has a seemingly useless lifetime a, so I remove it. If this is intentional, please reject this PR. ```rust pub trait ArchiveBuilder<'a> { fn add_file(&mut self, path: &Path); fn add_archive( &mut self, archive: &Path, skip: Box<dyn FnMut(&str) -> bool + 'static>, ) -> io::Result<()>; fn build(self: Box<Self>, output: &Path) -> bool; } ```
2024-02-26remove useless lifetime of ArchiveBuilder823984418-1/+1
2024-02-26rename 'try' intrinsic to 'catch_unwind'Ralf Jung-2/+2
2024-02-24Implement asm goto in MIR and MIR loweringGary Guo-1/+5
2024-02-24Change InlineAsm to allow multiple targets insteadGary Guo-2/+14
2024-02-21remove simd_reduce_{min,max}_nanlessRalf Jung-2/+2
2024-02-21Auto merge of #120718 - saethlin:reasonable-fast-math, r=nnethercotebors-6/+15
Add "algebraic" fast-math intrinsics, based on fast-math ops that cannot return poison Setting all of LLVM's fast-math flags makes our fast-math intrinsics very dangerous, because some inputs are UB. This set of flags permits common algebraic transformations, but according to the [LangRef](https://llvm.org/docs/LangRef.html#fastmath), only the flags `nnan` (no nans) and `ninf` (no infs) can produce poison. And this uses the algebraic float ops to fix https://github.com/rust-lang/rust/issues/120720 cc `@orlp`
2024-02-20Add "algebraic" versions of the fast-math intrinsicsBen Kimock-6/+15
2024-02-17Rollup merge of #121209 - nnethercote:infallible-join_codegen, r=bjorn3Matthias Krüger-3/+3
Make `CodegenBackend::join_codegen` infallible. Because they all are, in practice. r? ```@bjorn3```
2024-02-17Make `CodegenBackend::join_codegen` infallible.Nicholas Nethercote-3/+3
Because they all are, in practice.
2024-02-12Give const_deallocate a default bodyOli Scherer-5/+0
2024-02-12Teach llvm backend how to fall back to default bodiesOli Scherer-14/+6
2024-02-12Add intrinsic body fallback to cranelift and use itOli Scherer-35/+32
2024-02-09Auto merge of #120843 - matthiaskrgr:rollup-med37z5, r=matthiaskrgrbors-0/+2
Rollup of 8 pull requests Successful merges: - #113671 (Make privacy visitor use types more (instead of HIR)) - #120308 (core/time: avoid divisions in Duration::new) - #120693 (Invert diagnostic lints.) - #120704 (A drive-by rewrite of `give_region_a_name()`) - #120809 (Use `transmute_unchecked` in `NonZero::new`.) - #120817 (Fix more `ty::Error` ICEs in MIR passes) - #120828 (Fix `ErrorGuaranteed` unsoundness with stash/steal.) - #120831 (Startup objects disappearing from sysroot) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-08Add a new debug_assertions instrinsic (compiler)Ben Kimock-0/+9
And in clippy
2024-02-06Invert diagnostic lints.Nicholas Nethercote-0/+2
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-01-30Remove the `abi_amdgpu_kernel` featureclubby789-5/+1
2024-01-26Merge commit '3e50cf65025f96854d6597e80449b0d64ad89589' into ↵bjorn3-234/+254
sync_cg_clif-2024-01-26
2024-01-25Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obkbors-0/+6
Replacement of #114390: Add new intrinsic `is_var_statically_known` and optimize pow for powers of two This adds a new intrinsic `is_val_statically_known` that lowers to [``@llvm.is.constant.*`](https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic).` It also applies the intrinsic in the int_pow methods to recognize and optimize the idiom `2isize.pow(x)`. See #114390 for more discussion. While I have extended the scope of the power of two optimization from #114390, I haven't added any new uses for the intrinsic. That can be done in later pull requests. Note: When testing or using the library, be sure to use `--stage 1` or higher. Otherwise, the intrinsic will be a noop and the doctests will be skipped. If you are trying out edits, you may be interested in [`--keep-stage 0`](https://rustc-dev-guide.rust-lang.org/building/suggested.html#faster-builds-with---keep-stage). Fixes #47234 Resolves #114390 `@Centri3`
2024-01-23Further Implement `is_val_statically_known`Nicholas Thompson-0/+6
2024-01-22Do not normalize closure signature when building FnOnce shimMichael Goulet-1/+0
2024-01-15compiler: Lower fn call arg spans down to MIRMartin Nordholts-72/+77
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-09Rollup merge of #118903 - azhogin:azhogin/skip_second_stmt_debuginfo.rs, ↵Matthias Krüger-9/+1
r=petrochenkov Improved support of collapse_debuginfo attribute for macros. Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain. Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap). cc https://github.com/rust-lang/rust/issues/100758
2024-01-08Improved support of collapse_debuginfo attribute for macros.Andrew Zhogin-9/+1
2024-01-08Use chaining for `DiagnosticBuilder` construction and `emit`.Nicholas Nethercote-3/+4
To avoid the use of a mutable local variable, and because it reads more nicely.
2023-12-31Merge commit '6d355f6844323db03bfd608899613e363e701951' into ↵bjorn3-1/+3
sync_cg_clif-2023-12-31
2023-12-28Remove movability from TyKind::CoroutineMichael Goulet-2/+2
2023-12-26Auto merge of #119146 - nnethercote:rm-DiagCtxt-api-duplication, ↵bors-69/+79
r=compiler-errors Remove `DiagCtxt` API duplication `DiagCtxt` defines the internal API for creating and emitting diagnostics: methods like `struct_err`, `struct_span_warn`, `note`, `create_fatal`, `emit_bug`. There are over 50 methods. Some of these methods are then duplicated across several other types: `Session`, `ParseSess`, `Parser`, `ExtCtxt`, and `MirBorrowckCtxt`. `Session` duplicates the most, though half the ones it does are unused. Each duplicated method just calls forward to the corresponding method in `DiagCtxt`. So this duplication exists to (in the best case) shorten chains like `ecx.tcx.sess.parse_sess.dcx.emit_err()` to `ecx.emit_err()`. This API duplication is ugly and has been bugging me for a while. And it's inconsistent: there's no real logic about which methods are duplicated, and the use of `#[rustc_lint_diagnostic]` and `#[track_caller]` attributes vary across the duplicates. This PR removes the duplicated API methods and makes all diagnostic creation and emission go through `DiagCtxt`. It also adds `dcx` getter methods to several types to shorten chains. This approach scales *much* better than API duplication; indeed, the PR adds `dcx()` to numerous types that didn't have API duplication: `TyCtxt`, `LoweringCtxt`, `ConstCx`, `FnCtxt`, `TypeErrCtxt`, `InferCtxt`, `CrateLoader`, `CheckAttrVisitor`, and `Resolver`. These result in a lot of changes from `foo.tcx.sess.emit_err()` to `foo.dcx().emit_err()`. (You could do this with more types, but it gets into diminishing returns territory for types that don't emit many diagnostics.) After all these changes, some call sites are more verbose, some are less verbose, and many are the same. The total number of lines is reduced, mostly because of the removed API duplication. And consistency is increased, because calls to `emit_err` and friends are always preceded with `.dcx()` or `.dcx`. r? `@compiler-errors`
2023-12-24Fix borked subtree syncsbjorn3-1/+1
2023-12-24Merge commit '26c02eb2904da9a53d2220d4f3069b19a3c81d3d' into ↵bjorn3-0/+31
sync_cg_clif-2023-12-24
2023-12-24Remove more `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-4/+4
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-65/+75
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-22Rollup merge of #119171 - nnethercote:cleanup-errors-4, r=compiler-errorsMichael Goulet-1/+1
Cleanup error handlers: round 4 More `rustc_errors` cleanups. A sequel to #118933. r? `@compiler-errors`
2023-12-23Rename `EarlyDiagCtxt` methods to match `DiagCtxt`.Nicholas Nethercote-1/+1
- `early_error_no_abort` -> `early_err` - `early_error` -> `early_fatal` - `early_struct_error` -> `early_struct_fatal`
2023-12-22update cfg(bootstrap)sPietro Albini-3/+3
2023-12-19Merge commit '3a9bf729322fb5035518f99b9d76a742bf7c124e' into ↵bjorn3-85/+138
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