about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
AgeCommit message (Collapse)AuthorLines
2024-07-09Auto merge of #127001 - beetrees:f16-debuginfo, r=michaelwoeristerbors-3/+40
Add Natvis visualiser and debuginfo tests for `f16` To render `f16`s in debuggers on MSVC targets, this PR changes the compiler to output `f16`s as `struct f16 { bits: u16 }`, and includes a Natvis visualiser that manually converts the `f16`'s bits to a `float` which is can then be displayed by debuggers. `gdb`, `lldb` and `cdb` tests are also included for `f16` . `f16`/`f128` MSVC debug info issue: #121837 Tracking issue: #116909
2024-07-09Add Natvis visualiser and debuginfo tests for `f16`beetrees-3/+40
2024-07-05Auto merge of #126171 - RalfJung:simd_bitmask_multibyte, r=workingjubileebors-8/+8
simd_bitmask intrinsic: add a non-power-of-2 multi-byte example r? `@calebzulawski` `@workingjubilee`
2024-07-04Auto merge of #123781 - RalfJung:miri-fn-identity, r=oli-obkbors-2/+2
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-03Rollup merge of #126803 - tgross35:verbose-asm, r=AmanieuMatthias Krüger-5/+5
Change `asm-comments` to `verbose-asm`, always emit user comments Implements what is described in https://github.com/rust-lang/compiler-team/issues/762 Tracking issue: https://github.com/rust-lang/rust/issues/126802
2024-07-03Auto merge of #125507 - compiler-errors:type-length-limit, r=lcnrbors-1/+2
Re-implement a type-size based limit r? lcnr This PR reintroduces the type length limit added in #37789, which was accidentally made practically useless by the caching changes to `Ty::walk` in #72412, which caused the `walk` function to no longer walk over identical elements. Hitting this length limit is not fatal unless we are in codegen -- so it shouldn't affect passes like the mir inliner which creates potentially very large types (which we observed, for example, when the new trait solver compiles `itertools` in `--release` mode). This also increases the type length limit from `1048576 == 2 ** 20` to `2 ** 24`, which covers all of the code that can be reached with craterbot-check. Individual crates can increase the length limit further if desired. Perf regression is mild and I think we should accept it -- reinstating this limit is important for the new trait solver and to make sure we don't accidentally hit more type-size related regressions in the future. Fixes #125460
2024-07-02Rename the `asm-comments` compiler flag to `verbose-asm`Trevor Gross-5/+5
Since this codegen flag now only controls LLVM-generated comments rather than all assembly comments, make the name more accurate (and also match Clang).
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-2/+2
2024-07-02Rollup merge of #127168 - DianQK:cast-size, r=workingjubileeMatthias Krüger-1/+2
Use the aligned size for alloca at args/ret when the pass mode is cast Fixes #75839. Fixes #121028. The `load` and `store` instructions in LLVM access the aligned size. For example, `load { i64, i32 }` accesses 16 bytes on x86_64: https://alive2.llvm.org/ce/z/n8CHAp. BTW, this example is expected to be optimized to immediate UB by Alive2: https://rust.godbolt.org/z/b7xK7hv1c and https://alive2.llvm.org/ce/z/vZDtZH. r? compiler
2024-07-02Use the aligned size for alloca at args when the pass mode is cast.DianQK-1/+2
The `load` and `store` instructions in LLVM access the aligned size.
2024-07-01fix simd_bitmask return type for non-power-of-two inputs, and add testsRalf Jung-8/+8
2024-06-29Rollup merge of #123237 - bjorn3:debuginfo_refactor, r=compiler-errorsMatthias Krüger-58/+60
Various rustc_codegen_ssa cleanups
2024-06-25Support `#[patchable_function_entries]`Matthew Maurer-3/+6
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered) TODO before submission: * Needs an RFC * Improve error reporting for malformed attributes
2024-06-25Support for -Z patchable-function-entryMatthew Maurer-0/+26
`-Z patchable-function-entry` works like `-fpatchable-function-entry` on clang/gcc. The arguments are total nop count and function offset. See MCP rust-lang/compiler-team#704
2024-06-24Rollup merge of #124712 - Enselic:deprecate-inline-threshold, r=pnkfelixMichael Goulet-3/+0
Deprecate no-op codegen option `-Cinline-threshold=...` This deprecates `-Cinline-threshold` since using it has no effect. This has been the case since the new LLVM pass manager started being used, more than 2 years ago. Recommend using `-Cllvm-args=--inline-threshold=...` instead. Closes #89742 which is E-help-wanted.
2024-06-23compiler(nfc): -Cforce-frame-pointers is a FramePointerJubilee Young-2/+3
2024-06-22Rollup merge of #126555 - beetrees:f16-inline-asm-arm, r=AmanieuGuillaume Gomez-0/+39
Add `f16` inline ASM support for 32-bit ARM Adds `f16` inline ASM support for 32-bit ARM. SIMD vector types are taken from [here](https://developer.arm.com/architectures/instruction-sets/intrinsics/#f:`@navigationhierarchiesreturnbasetype=[float]&f:@navigationhierarchieselementbitsize=[16]&f:@navigationhierarchiesarchitectures=[A32]).` Relevant issue: #125398 Tracking issue: #116909 `@rustbot` label +F-f16_and_f128
2024-06-21Rollup merge of #126530 - beetrees:f16-inline-asm-riscv, r=AmanieuJubilee-6/+49
Add `f16` inline ASM support for RISC-V This PR adds `f16` inline ASM support for RISC-V. A `FIXME` is left for `f128` support as LLVM does not support the required `Q` (Quad-Precision Floating-Point) extension yet. Relevant issue: #125398 Tracking issue: #116909 `@rustbot` label +F-f16_and_f128
2024-06-21Remove type_i1 and type_struct from cg_ssabjorn3-14/+14
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-4/+0
2024-06-21Remove PrintBackendInfo traitbjorn3-25/+29
It is only implemented for a single type. Directly passing this type is simpler and avoids overhead from indirect calls.
2024-06-21Move vcall_visibility_metadata optimization hint out of a debuginfo ↵bjorn3-7/+17
generation method
2024-06-21Add `f16` inline ASM support for RISC-Vbeetrees-6/+49
2024-06-21Add `f16` inline ASM support for 32-bit ARMbeetrees-0/+39
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-37/+41
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-16Rollup merge of #126365 - Dirbaio:collapse-debuginfo-statics, r=workingjubilee许杰友 Jieyou Xu (Joe)-2/+2
Honor collapse_debuginfo for statics. fixes #126363 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> -->
2024-06-15Rollup merge of #126424 - Enselic:sort-target-features, r=lqdMatthias Krüger-0/+5
Also sort `crt-static` in `--print target-features` output I didn't find `crt-static` at first (for `x86_64-unknown-linux-gnu`), because it was put at the bottom of the large and otherwise sorted list. Fully sort the list before we print it. Note that `llvm_target_features` starts out and remains sorted and does not need to be sorted an extra time. On my machine the diff is just: ```diff $ diff -u /tmp/before2.txt /tmp/after2.txt --- /tmp/before2.txt 2024-06-13 20:40:27.091636592 +0200 +++ /tmp/after2.txt 2024-06-13 20:39:54.584894891 +0200 ``@@`` -20,6 +20,7 ``@@`` bmi1 - Support BMI instructions. bmi2 - Support BMI2 instructions. cmpxchg16b - 64-bit with cmpxchg16b (this is true for most x86-64 chips, but not the first AMD chips). + crt-static - Enables C Run-time Libraries to be statically linked. ermsb - REP MOVS/STOS are fast. f16c - Support 16-bit floating point conversion instructions. fma - Enable three-operand fused multiple-add. ``@@`` -49,7 +50,6 ``@@`` xsavec - Support xsavec instructions. xsaveopt - Support xsaveopt instructions. xsaves - Support xsaves instructions. - crt-static - Enables C Run-time Libraries to be statically linked. Code-generation features supported by LLVM for this target: 16bit-mode - 16-bit mode (i8086). ``` I couldn't find a ui test that tested this output. Let's see if CI finds a regression tests.
2024-06-14Deprecate no-op codegen option `-Cinline-threshold=...`Martin Nordholts-3/+0
This deprecates `-Cinline-threshold` since using it has no effect. This has been the case since the new LLVM pass manager started being used, more than 2 years ago.
2024-06-14Also sort `crt-static` in `--print target-features` outputMartin Nordholts-0/+5
I didn't find `crt-static` at first (for `x86_64-unknown-linux-gnu`), because it was put at the bottom the large and otherwise sorted list. Fully sort the list before we print it. Note that `llvm_target_features` starts out sorted and does not need to be sorted an extra time.
2024-06-13Add `f16` and `f128` inline ASM support for `x86` and `x86-64`beetrees-0/+100
2024-06-13Honor collapse_debuginfo for statics.Dario Nieuwenhuis-2/+2
fixes #126363
2024-06-12Rollup merge of #126324 - zmodem:loongarch, r=nikicMichael Goulet-0/+8
Adjust LoongArch64 data layouts for LLVM update The data layout was changed in LLVM 19: llvm/llvm-project#93814
2024-06-12Adjust LoongArch64 data layouts for LLVM updateHans Wennborg-0/+8
The data layout was changed in LLVM 19: llvm/llvm-project#93814
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-3/+5
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-06-10Rollup merge of #126159 - RalfJung:scalarint-size-mismatch, r=oli-obkMatthias Krüger-2/+2
ScalarInt: size mismatches are a bug, do not delay the panic Cc [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Why.20are.20ScalarInt.20to.20iN.2FuN.20methods.20fallible.3F) r? ``@oli-obk``
2024-06-10ScalarInt: size mismatches are a bug, do not delay the panicRalf Jung-2/+2
2024-06-08simd packed types: update outdated check, extend codegen testRalf Jung-4/+6
2024-06-06Auto merge of #125406 - tbu-:pr_rm_path_with_extension, r=Nadrierilbors-7/+2
Directly add extension instead of using `Path::with_extension` `Path::with_extension` has a nice footgun when the original path doesn't contain an extension: Anything after the last dot gets removed.
2024-06-05Add `Ty` to `ConstKind::Value`Boxy-0/+1
2024-06-04Directly add extension instead of using `Path::with_extension`Tobias Bucher-7/+2
`Path::with_extension` has a nice footgun when the original path doesn't contain an extension: Anything after the last dot gets removed.
2024-06-02Rollup merge of #125311 - calebzulawski:repr-packed-simd-intrinsics, ↵Jubilee-1/+53
r=workingjubilee Make repr(packed) vectors work with SIMD intrinsics In #117116 I fixed `#[repr(packed, simd)]` by doing the expected thing and removing padding from the layout. This should be the last step in providing a solution to rust-lang/portable-simd#319
2024-06-01Improve documentationCaleb Zulawski-1/+6
2024-06-01Uplift TypeRelation and RelateMichael Goulet-4/+5
2024-05-30coverage: Rename MC/DC `conditions_num` to `num_conditions`Zalathar-3/+4
This value represents a quantity of conditions, not an ID, so the new spelling is more appropriate.
2024-05-29Rollup merge of #124655 - Darksonn:fixed-x18, r=lqd,estebankMatthias Krüger-1/+16
Add `-Zfixed-x18` This PR is a follow-up to #124323 that proposes a different implementation. Please read the description of that PR for motivation. See the equivalent flag in [the clang docs](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-ffixed-x18). MCP: https://github.com/rust-lang/compiler-team/issues/748 Fixes https://github.com/rust-lang/rust/issues/121970 r? rust-lang/compiler
2024-05-24Auto merge of #125463 - GuillaumeGomez:rollup-287wx4y, r=GuillaumeGomezbors-8/+49
Rollup of 6 pull requests Successful merges: - #125263 (rust-lld: fallback to rustc's sysroot if there's no path to the linker in the target sysroot) - #125345 (rustc_codegen_llvm: add support for writing summary bitcode) - #125362 (Actually use TAIT instead of emulating it) - #125412 (Don't suggest adding the unexpected cfgs to the build-script it-self) - #125445 (Migrate `run-make/rustdoc-with-short-out-dir-option` to `rmake.rs`) - #125452 (Cleanup check-cfg handling in core and std) r? `@ghost` `@rustbot` modify labels: rollup