about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
AgeCommit message (Collapse)AuthorLines
2022-10-06Rollup merge of #102725 - nnethercote:rm-Z-time, r=davidtwcoMatthias Krüger-1/+1
Remove `-Ztime` Because it has a lot of overlap with `-Ztime-passes` but is generally less useful. Plus some related cleanups. Best reviewed one commit at a time. r? `@davidtwco`
2022-10-06Remove `-Ztime` option.Nicholas Nethercote-1/+1
The compiler currently has `-Ztime` and `-Ztime-passes`. I've used `-Ztime-passes` for years but only recently learned about `-Ztime`. What's the difference? Let's look at the `-Zhelp` output: ``` -Z time=val -- measure time of rustc processes (default: no) -Z time-passes=val -- measure time of each rustc pass (default: no) ``` The `-Ztime-passes` description is clear, but the `-Ztime` one is less so. Sounds like it measures the time for the entire process? No. The real difference is that `-Ztime-passes` prints out info about passes, and `-Ztime` does the same, but only for a subset of those passes. More specifically, there is a distinction in the profiling code between a "verbose generic activity" and an "extra verbose generic activity". `-Ztime-passes` prints both kinds, while `-Ztime` only prints the first one. (It took me a close reading of the source code to determine this difference.) In practice this distinction has low value. Perhaps in the past the "extra verbose" output was more voluminous, but now that we only print stats for a pass if it exceeds 5ms or alters the RSS, `-Ztime-passes` is less spammy. Also, a lot of the "extra verbose" cases are for individual lint passes, and you need to also use `-Zno-interleave-lints` to see those anyway. Therefore, this commit removes `-Ztime` and the associated machinery. One thing to note is that the existing "extra verbose" activities all have an extra string argument, so the commit adds the ability to accept an extra argument to the "verbose" activities.
2022-10-05Auto merge of #98736 - alex:lipo-magic, r=bjorn3bors-3/+64
resolve error when attempting to link a universal library on macOS Previously attempting to link universal libraries into libraries (but not binaries) would produce an error that "File too small to be an archive". This works around this by invoking `lipo -thin` to extract a library for the target platform when passed a univeral library. Fixes #55235 It's worth acknowledging that this implementation is kind of a horrible hack. Unfortunately I don't know how to do anything better, hopefully this PR will be a jumping off point.
2022-10-04resolve error when attempting to link a universal library on macOSAlex Gaynor-3/+64
Previously attempting to link universal libraries into libraries (but not binaries) would produce an error that "File too small to be an archive". This works around this by using `object` to extract a library for the target platform when passed a univeral library. Fixes #55235
2022-10-03Auto merge of #102551 - bjorn3:cg_ssa_cleanup, r=davidtwcobors-66/+65
Some more cleanup for rustc_codegen_ssa With the aim to make non-LLVM like backends, like Cranelift, easier to support using cg_ssa.
2022-10-02Remove type argument of array_alloca and rename to byte_array_allocabjorn3-2/+3
2022-10-02Remove dynamic_alloca from BuilderMethodsbjorn3-5/+1
2022-10-02Auto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisabors-1/+11
Declare `main` as visibility hidden on targets that default to hidden. On targets with `default_hidden_visibility` set, which is currrently just WebAssembly, declare the generated `main` function with visibility hidden. This makes it consistent with clang's WebAssembly target, where `main` is just a user function that gets the same visibility as any other user function, which is hidden on WebAssembly unless explicitly overridden. This will help simplify use cases which in the future may want to automatically wasm-export all visibility-"default" symbols. `main` isn't intended to be wasm-exported, and marking it hidden prevents it from being wasm-exported in that scenario.
2022-10-01Merge apply_attrs_callsite into call and invokebjorn3-28/+51
Some codegen backends are not able to apply callsite attrs after the fact.
2022-10-01Remove unused target_cpu and tune_cpu methods from ExtraBackendMethodsbjorn3-6/+0
2022-10-01Remove several unused methods from MiscMethodsbjorn3-24/+10
2022-10-01Remove unused Context assoc type from WriteBackendMethodsbjorn3-1/+0
2022-09-29Adjust the s390x data layout for LLVM 16Josh Stone-0/+5
LLVM [D131158] changed the SystemZ data layout to always set 64-bit vector alignment, which used to be conditional on the "vector" feature. [D131158]: https://reviews.llvm.org/D131158
2022-09-28Change `declare_cfn` to use the C visibility for all C ABI functions.Dan Gohman-36/+15
2022-09-28Use the existing `set_visibility` function.Dan Gohman-7/+1
2022-09-28Declare `main` as visibility hidden on targets that default to hidden.Dan Gohman-9/+46
On targets with `default_hidden_visibility` set, which is currrently just WebAssembly, declare the generated `main` function with visibility hidden. This makes it consistent with clang's WebAssembly target, where `main` is just a user function that gets the same visibility as any other user function, which is hidden on WebAssembly unless explicitly overridden. This will help simplify use cases which in the future may want to automatically wasm-export all visibility-"default" symbols. `main` isn't intended to be wasm-exported, and marking it hidden prevents it from being wasm-exported in that scenario.
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-417/+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-417/+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/+16
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.