about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2022-09-27rustc_typeck to rustc_hir_analysislcnr-1/+1
2022-09-26remove cfg(bootstrap)Pietro Albini-1/+0
2022-09-25Rollup merge of #101997 - cuviper:drop-legacy-pm, r=nikicfee1-dead-418/+18
Remove support for legacy PM This removes support for optimizing with LLVM's legacy pass manager, as well as the unstable `-Znew-llvm-pass-manager` option. We have been defaulting to the new PM since LLVM 13 (except for s390x that waited for 14), and LLVM 15 removed support altogether. The only place we still use the legacy PM is for writing the output file, just like `llc` does. cc #74705 r? ``@nikic``
2022-09-19Rename LLVM `optimize` functionsJosh Stone-5/+5
2022-09-18Use LLVM C-API to build atomic cmpxchg and fenceJosh Stone-37/+25
2022-09-18Remove -Znew-llvm-pass-managerJosh Stone-4/+0
2022-09-18Remove support for LLVM's legacy pass managerJosh Stone-418/+22
2022-09-17Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obkDylan DPC-0/+91
Implement simd_as for pointers Expands `simd_as` (and `simd_cast`) to handle pointer-to-pointer, pointer-to-integer, and integer-to-pointer conversions. cc ``@programmerjake`` ``@thomcc``
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-14Auto merge of #99443 - jam1garner:mips-virt-feature, r=nagisabors-0/+4
Add support for MIPS VZ ISA extension [Link to relevant LLVM line where virt extension is specified](https://github.com/llvm/llvm-project/blob/83fab8cee9d6b9fa911195c20325b4512a7a22ef/llvm/lib/Target/Mips/Mips.td#L172-L173) This has been tested on mips-unknown-linux-musl with a target-cpu that is >= MIPS32 5 and `target-features=+virt`. The example was checked in a disassembler to ensure the correct assembly sequence was being generated using the virtualization instructions. Needed additional work: * MIPS is missing from [the Rust reference CPU feature lists](https://doc.rust-lang.org/reference/attributes/codegen.html#available-features) Example docs for later: ```md #### `mips` or `mips64` This platform requires that `#[target_feature]` is only applied to [`unsafe` functions][unsafe function]. This target's feature support is currently unstable and must be enabled by `#![feature(mips_target_feature)]` ([Issue #44839]) [Issue #44839]: https://github.com/rust-lang/rust/issues/44839 Further documentation on these features can be found in the [MIPS Instruction Set Reference Manual], or elsewhere on [mips.com]. [MIPS Instruction Set Reference Manual]: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-6.06.pdf [developer.arm.com]: https://www.mips.com/products/architectures/ase/ Feature | Implicitly Enables | Description ---------------|--------------------|------------------- `fp64` | | 64-bit Floating Point `msa` | | "MIPS SIMD Architecture" `virt` | | Virtualization instructions (VZ ASE) ``` If the above is good I can also submit a PR for that if there's interest in documenting it while it's still unstable. Otherwise that can be dropped, I just wrote it before realizing it was possibly not a good idea. Relevant to #44839
2022-09-12Rollup merge of #100293 - yanchen4791:add-inline-llvm-option, r=nnethercoteDylan DPC-0/+4
Add inline-llvm option for disabling/enabling LLVM inlining In this PR, a new -Z option `inline-llvm` is added in order to be able to turn on/off LLVM inlining. The capability of turning on/off inlining in LLVM backend is needed for testing performance implications of using recently enabled inlining in rustc's frontend (with -Z inline-mir=yes option, #91743). It would be interesting to see the performance effect using rustc's frontend inlining only without LLVM inlining enabled. Currently LLVM is still doing inlining no mater what value inline-mir is set to. With the option `inline-llvm` being added in this PR, user can turn off LLVM inlining by using `-Z inline-llvm=no` option (the default of inline-llvm is 'yes', LLVM inlining enabled).
2022-09-09Add inline-llvm option for disabling/enabling LLVM inliningYan Chen-0/+4
2022-09-09Introduce a fallible variant of LLVMConstIntGetZExtValueTomasz Miąsko-2/+6
which verifies that a constant bit width is within 64 bits or fails.
2022-09-09Rollup merge of #99207 - 5225225:msan-eager-checks, r=jackh726Matthias Krüger-0/+8
Enable eager checks for memory sanitizer Fixes #99179
2022-09-07Change name of "dataful" variant to "untagged"Michael Benfield-13/+13
This is in anticipation of a new enum layout, in which the niche optimization may be applied even when multiple variants have data.
2022-09-07Rollup merge of #101484 - oli-obk:no_zst, r=eddybYuki Okushi-4/+0
Remove dead broken code from const zst handling in backends cc `@RalfJung` found by `@eddyb` in https://github.com/rust-lang/rust/pull/98957#discussion_r963744605
2022-09-06Remove dead broken code from const zst handling in backendsOli Scherer-4/+0
2022-09-06get_attr should check that no duplicates are allowedyukang-1/+2
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-20/+5
by module
2022-09-01Directly use the `instrument` macro instead of its full pathOli Scherer-2/+2
2022-08-30Auto merge of #101195 - Dylan-DPC:rollup-rhjaz6r, r=Dylan-DPCbors-9/+4
Rollup of 5 pull requests Successful merges: - #99517 (Display raw pointer as *{mut,const} T instead of *-ptr in errors) - #99928 (Do not leak type variables from opaque type relation) - #100473 (Attempt to normalize `FnDef` signature in `InferCtxt::cmp`) - #100653 (Move the cast_float_to_int fallback code to GCC) - #100941 (Point at the string inside literal and mention if we need string inte…) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-30Rollup merge of #100653 - cuviper:fptoint_sat, r=michaelwoerister,antoyoDylan DPC-9/+4
Move the cast_float_to_int fallback code to GCC Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-30Auto merge of #98100 - bjorn3:use_object_for_bitcode_reading, r=wesleywiserbors-17/+17
Use object instead of LLVM for reading bitcode from rlibs Together with changes I plan to make as part of https://github.com/rust-lang/rust/pull/97485 this will allow entirely removing usage of LLVM's archive reader and thus allow removing `archive_ro.rs` and `ArchiveWrapper.cpp`.
2022-08-30Auto merge of #101183 - Dylan-DPC:rollup-6kewixv, r=Dylan-DPCbors-11/+11
Rollup of 9 pull requests Successful merges: - #95376 (Add `vec::Drain{,Filter}::keep_rest`) - #100092 (Fall back when relating two opaques by substs in MIR typeck) - #101019 (Suggest returning closure as `impl Fn`) - #101022 (Erase late bound regions before comparing types in `suggest_dereferences`) - #101101 (interpret: make read-pointer-as-bytes a CTFE-only error with extra information) - #101123 (Remove `register_attr` feature) - #101175 (Don't --bless in pre-push hook) - #101176 (rustdoc: remove unused CSS selectors for `.table-display`) - #101180 (Add another MaybeUninit array test with const) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-11/+11
interpret: make read-pointer-as-bytes a CTFE-only error with extra information Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456. Pointer-to-int transmutation during CTFE now produces a message like this: ``` = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported ``` r? ``@oli-obk``
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-28Rollup merge of #101098 - petrochenkov:noinvis, r=TaKO8KiMatthias Krüger-11/+5
rustc_middle: Remove `Visibility::Invisible` It had a different meaning in the past, but now it's only used as an implementation detail of import resolution.
2022-08-28Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcmbors-0/+4
Add pointer masking convenience functions This PR adds the following public API: ```rust impl<T: ?Sized> *const T { fn mask(self, mask: usize) -> *const T; } impl<T: ?Sized> *mut T { fn mask(self, mask: usize) -> *const T; } // mod intrinsics fn mask<T>(ptr: *const T, mask: usize) -> *const T ``` This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic. Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352 cc `@Gankra` `@scottmcm` `@RalfJung` r? rust-lang/libs-api
2022-08-27rustc_middle: Remove `Visibility::Invisible`Vadim Petrochenkov-11/+5
2022-08-27interpret: rename relocation → provenanceRalf Jung-11/+11
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-53/+48
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-27Check pointer metadata rather than pointee sizeCaleb Zulawski-10/+14
2022-08-26Implementation of import_name_typeDaniel Paoliello-31/+103
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-21/+22
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Turn `ArgAbi::pad` into a `bool`.Nicholas Nethercote-4/+4
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26Simplify arg capacity calculations.Nicholas Nethercote-5/+2
Currently they try to be very precise. But they are wrong, i.e. they don't match what's happening in the loop below. This code isn't hot enough for it to matter that much.
2022-08-26Change `FnAbi::args` to a boxed slice.Nicholas Nethercote-2/+2
2022-08-26Change `FnAbi::fixed_count` to a `u32`.Nicholas Nethercote-1/+2
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-27/+23
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
2022-08-21Do not use void pointer for `ptr_mask` intrinsicMaybe Waffle-2/+1
I couldn't find where exactly it's documented, but apperantly pointers to void type are invalid in llvm - void is only allowed as a return type of functions.
2022-08-21Add pointer masking convenience functionsMaybe Waffle-0/+5
This commit adds the following functions all of which have a signature `pointer, usize -> pointer`: - `<*mut T>::mask` - `<*const T>::mask` - `intrinsics::ptr_mask` These functions are equivalent to `.map_addr(|a| a & mask)` but they utilize `llvm.ptrmask` llvm intrinsic. *masks your pointers*
2022-08-16Move the cast_float_to_int fallback code to GCCJosh Stone-9/+4
Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-16Rollup merge of #100460 - cuviper:drop-llvm-12, r=nagisaMatthias Krüger-103/+26
Update the minimum external LLVM to 13 With this change, we'll have stable support for LLVM 13 through 15 (pending release). For reference, the previous increase to LLVM 12 was #90175. r? `@nagisa`
2022-08-16Rollup merge of #100384 - ridwanabdillahi:instr_profile_output, r=wesleywiserMatthias Krüger-0/+11
Add support for generating unique profraw files by default when using `-C instrument-coverage` Currently, enabling the rustc flag `-C instrument-coverage` instruments the given crate and by default uses the naming scheme `default.profraw` for any instrumented profile files generated during the execution of a binary linked against this crate. This leads to multiple binaries being executed overwriting one another and causing only the last executable run to contain actual coverage results. This can be overridden by manually setting the environment variable `LLVM_PROFILE_FILE` to use a unique naming scheme. This PR adds a change to add support for a reasonable default for rustc to use when enabling coverage instrumentation similar to how the Rust compiler treats generating these same `profraw` files when PGO is enabled. The new naming scheme is set to `default_%m_%p.profraw` to ensure the uniqueness of each file being generated using [LLVMs special pattern strings](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program). Today the compiler sets the default for PGO `profraw` files to `default_%m.profraw` to ensure a unique file for each run. The same can be done for the instrumented profile files generated via the `-C instrument-coverage` flag as well which LLVM has API support for. Linked Issue: https://github.com/rust-lang/rust/issues/100381 r? `@wesleywiser`
2022-08-15Auto merge of #98393 - michaelwoerister:new-cpp-like-enum-debuginfo, ↵bors-199/+664
r=wesleywiser debuginfo: Generalize C++-like encoding for enums. The updated encoding should be able to handle niche layouts where more than one variant has fields (as introduced in https://github.com/rust-lang/rust/pull/94075). The new encoding is more uniform as there is no structural difference between direct-tag, niche-tag, and no-tag layouts anymore. The only difference between those cases is that the "dataful" variant in a niche-tag enum will have a `(start, end)` pair denoting the tag range instead of a single value. The new encoding now also supports 128-bit tags, which occur in at least some standard library types. These tags are represented as `u64` pairs so that debuggers (which don't always have support for 128-bit integers) can reliably deal with them. The downside is that this adds quite a bit of complexity to the encoding and especially to the corresponding NatVis. The new encoding seems to increase the size of (x86_64-pc-windows-msvc) debuginfo by 10-15%. The size of binaries is not affected (release builds were built with `-Cdebuginfo=2`, numbers are in kilobytes): EXE | before | after | relative -- | -- | -- | -- cargo (debug) | 40453 | 40450 | +0% ripgrep (debug) | 10275 | 10273 | +0% cargo (release) | 16186 | 16185 | +0% ripgrep (release) | 4727 | 4726 | +0% PDB | before | after | relative -- | -- | -- | -- cargo (debug) | 236524 | 261412 | +11% ripgrep (debug) | 53140 | 59060 | +11% cargo (release) | 148516 | 169620 | +14% ripgrep (release) | 10676 | 11804 | +11% Given that the new encoding is more general, this is to be expected. Only platforms using C++-like debuginfo are affected -- which currently is only `*-pc-windows-msvc`. *TODO* - [x] Properly update documentation - [x] Add regression tests for new optimized enum layouts as introduced by #94075. r? `@wesleywiser`
2022-08-14Update the minimum external LLVM to 13Josh Stone-103/+26
2022-08-14Emit noundef even for unoptimised code if msan is on5225225-0/+8
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-08-12Respond to RFC comments.ridwanabdillahi-1/+1
2022-08-12[debuginfo] Use IndexMap instead of FxHashMap while generating cpp-like ↵Michael Woerister-6/+15
generator debuginfo.