about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2024-09-20Rollup merge of #128209 - beetrees:no-macos-10.10, r=jieyouxuGuillaume Gomez-52/+0
Remove macOS 10.10 dynamic linker bug workaround Rust's current minimum macOS version is 10.12, so the hack can be removed. This PR also updates the `remove_dir_all` docs to reflect that all supported macOS versions are protected against TOCTOU race conditions (the fallback implementation was already removed in #127683). try-job: dist-x86_64-apple try-job: dist-aarch64-apple try-job: dist-apple-various try-job: aarch64-apple try-job: x86_64-apple-1
2024-09-21Support clobber_abi and vector/access registers (clobber-only) in s390x ↵Taiki Endo-0/+6
inline assembly
2024-09-19MetadataType type castLuv-Ray-11/+10
2024-09-19move placeLuv-Ray-8/+8
2024-09-19wrap `LLVMSetMetadata`Luv-Ray-20/+22
2024-09-19Reformat some comments.Nicholas Nethercote-66/+78
So they are less than 100 chars.
2024-09-19Merge adjacent `unsafe extern "C"` blocks.Nicholas Nethercote-26/+2
2024-09-19Avoid heavy repetition in `llvm/ffi.rs`.Nicholas Nethercote-70/+67
Through judicious use of `use` and `Self`.
2024-09-19Remove a low-value local variable.Nicholas Nethercote-2/+1
2024-09-19Fix a comment.Nicholas Nethercote-2/+2
I'm pretty sure `CodegenCx` applies to codegen units, rather than compilation units.
2024-09-19Reduce visibility.Nicholas Nethercote-1/+1
2024-09-19Reorder `ConstMethods`.Nicholas Nethercote-19/+19
It's crazy to have the integer methods in something close to random order. The reordering makes the gaps clear: `const_i64`, `const_i128`, `const_isize`, and `const_u16`. I guess they just aren't needed.
2024-09-19Streamline `hidden` visibility setting.Nicholas Nethercote-49/+29
In `get_fn` there is a complicated set of if/elses to determine if `hidden` visibility should be applied. There are five calls to `LLVMRustSetVisibility` and some repetition in the comments. This commit streamlines it a bit: - Computes `hidden` and then uses it to determine if a single call to `LLVMRustSetVisibility` occurs. - Converts some of the if/elses into boolean expressions. - Removes the repetitive comments. Overall this makes it quite a bit shorter, and I find it easier to read.
2024-09-19Remove a low-value comment.Nicholas Nethercote-5/+0
We rarely use parameter comments, and these ones don't tell us anything interesting.
2024-09-19Use a macro to factor out some repetitive code.Nicholas Nethercote-80/+27
Similar to the existing macro just above.
2024-09-19Reduce repetition in `target_is_apple`.Nicholas Nethercote-5/+6
2024-09-19Streamline `report_inline_asm`.Nicholas Nethercote-8/+7
By using `use`.
2024-09-19Rename a parameter.Nicholas Nethercote-2/+2
This seems to be a typo. `singletree` doesn't make sense, and everywhere else it is `singlethread`.
2024-09-19Streamline register methods.Nicholas Nethercote-292/+251
These can be made more concise, mostly through appropriate use of `use` declarations.
2024-09-19replace some deprecated functionsLuv-Ray-84/+54
2024-09-18Update the minimum external LLVM to 18Josh Stone-48/+7
2024-09-18Rollup merge of #130457 - nnethercote:cleanup-codegen-traits, r=bjorn3Matthias Krüger-32/+20
Cleanup codegen traits The traits governing codegen are quite complicated and hard to follow. This PR cleans them up a bit. r? `@bjorn3`
2024-09-17Use associative type defaults in `{Layout,FnAbi}OfHelpers`.Nicholas Nethercote-10/+0
This avoids some repetitive boilerplate code.
2024-09-17Rename supertraits of `CodegenMethods`.Nicholas Nethercote-16/+16
Supertraits of `BuilderMethods` are all called `XyzBuilderMethods`. Supertraits of `CodegenMethods` are all called `XyzMethods`. This commit changes the latter to `XyzCodegenMethods`, for consistency.
2024-09-17Rename `{ArgAbi,IntrinsicCall}Methods`.Nicholas Nethercote-2/+2
They both are part of `BuilderMethods`, and so should have `Builder` in their name like all the other traits in `BuilderMethods`.
2024-09-17Merge `HasCodegen` into `BuilderMethods`.Nicholas Nethercote-4/+2
It has `Backend` and `Deref` boudns, plus an associated type `CodegenCx`, and it has a single use. This commit "inlines" it into `BuilderMethods`, which makes the complicated backend trait situation a little simpler.
2024-09-15Rollup merge of #130325 - workingjubilee:plus-minus-zero-redux, ↵Jubilee-2/+2
r=RalfJung,jieyouxu Use -0.0 in `intrinsics::simd::reduce_add_unordered` -0.0 is the actual neutral additive float, not +0.0, and this matters to codegen. try-job: aarch64-gnu
2024-09-15Use -0.0 in `intrinsics::simd::reduce_add_unordered`Jubilee Young-2/+2
-0.0 is the actual neutral additive float, not +0.0, and this matters to codegen.
2024-09-15Rollup merge of #129897 - RalfJung:soft-float-ignored, r=UrgauMatthias Krüger-1/+7
deprecate -Csoft-float because it is unsound (and not fixable) See https://github.com/rust-lang/rust/issues/129893 for details. The general sentiment there seems to be that this flag has no use and sound alternatives exist, so let's add this warning and see if anyone out there disagrees. Also show a different warning on targets where it does nothing (as documented since https://github.com/rust-lang/rust/pull/36261): it seems to correspond to `-mfloat-abi` in GCC/clang, which is an ARM-specific option. To be really sure it does nothing, only forward the flag to LLVM for eabihf targets. This should not change behavior but makes me sleep better ;)
2024-09-14simd_shuffle: require index argument to be a vectorRalf Jung-52/+28
2024-09-13Auto merge of #130052 - khuey:clear-dilocation-after-const-emission, ↵bors-2/+8
r=michaelwoerister Don't leave debug locations for constants sitting on the builder indefinitely Because constants are currently emitted *before* the prologue, leaving the debug location on the IRBuilder spills onto other instructions in the prologue and messes up both line numbers as well as the point LLVM chooses to be the prologue end. Example LLVM IR (irrelevant IR elided): Before: ``` define internal { i64, i64 } `@_ZN3tmp3Foo18var_return_opt_try17he02116165b0fc08cE(ptr` align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8, !dbg !357 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) ``` After: ``` define internal { i64, i64 } `@_ZN3tmp3Foo18var_return_opt_try17h00b17d08874ddd90E(ptr` align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) ``` Note in particular how !357 from %residual.dbg.spill's dbg_declare no longer falls through onto the store to %self.dbg.spill. This fixes argument values at entry when the constant is a ZST (e.g. `<Option as Try>::Residual`). This fixes #130003 (but note that it does *not* fix issues with argument values and non-ZST constants, which emit their own stores that have debug info on them, like #128945). r? `@michaelwoerister`
2024-09-12Rollup merge of #130235 - compiler-errors:nested-if, r=michaelwoeristerStuart Cook-5/+3
Simplify some nested `if` statements Applies some but not all instances of `clippy::collapsible_if`. Some ended up looking worse afterwards, though, so I left those out. Also applies instances of `clippy::collapsible_else_if` Review with whitespace disabled please.
2024-09-12Auto merge of #117465 - paulmenage:small-data-limit, r=compiler-errorsbors-2/+32
Add -Z small-data-threshold This flag allows specifying the threshold size above which LLVM should not consider placing small objects in a `.sdata` or `.sbss` section. Support is indicated in the target options via the small-data-threshold-support target option, which can indicate either an LLVM argument or an LLVM module flag. To avoid duplicate specifications in a large number of targets, the default value for support is DefaultForArch, which is translated to a concrete value according to the target's architecture.
2024-09-11Rollup merge of #130114 - eduardosm:needless-returns, r=compiler-errorsJubilee-1/+1
Remove needless returns detected by clippy in the compiler
2024-09-11Simplify some nested if statementsMichael Goulet-5/+3
2024-09-10Add -Z small-data-thresholdPaul Menage-2/+32
This flag allows specifying the threshold size above which LLVM should not consider placing small objects in a .sdata or .sbss section. Support is indicated in the target options via the small-data-threshold-support target option, which can indicate either an LLVM argument or an LLVM module flag. To avoid duplicate specifications in a large number of targets, the default value for support is DefaultForArch, which is translated to a concrete value according to the target's architecture.
2024-09-09Rollup merge of #129981 - nnethercote:rm-serialize_bitcode, r=antoyo,tmiaskoJubilee-6/+2
Remove `serialized_bitcode` from `LtoModuleCodegen`. It's unused. r? ``@bjorn3``
2024-09-09Remove needless returns detected by clippy in the compilerEduardo Sánchez Muñoz-1/+1
2024-09-09Remove `serialized_bitcode` from `LtoModuleCodegen`.Nicholas Nethercote-6/+2
It's unused.
2024-09-07Auto merge of #129941 - BoxyUwU:bump-boostrap, r=albertlarsan68bors-1/+0
Bump boostrap compiler to new beta Accidentally left some comments on the update cfgs commit directly xd
2024-09-07Rollup merge of #129940 - liushuyu:s390x-target-features, r=RalfJungMichael Goulet-3/+1
s390x: Fix a regression related to backchain feature In #127506, we introduced a new IBM Z-specific target feature, `backchain`. This particular `target-feature` was available as a function-level attribute in LLVM 17 and below, so some hacks were used to avoid blowing up LLVM when querying the supported LLVM features. This led to an unfortunate regression where `cfg!(target-feature = "backchain")` will always return true. This pull request aims to fix this issue, and a test has been introduced to ensure it will never happen again. Fixes #129927. r? `@RalfJung`
2024-09-07Rollup merge of #129891 - nikic:naked-no-san, r=jackh726Michael Goulet-21/+25
Do not request sanitizers for naked functions Naked functions can only contain inline asm, so any instrumentation inserted by sanitizers is illegal. Don't request it. Fixes https://github.com/rust-lang/rust/issues/129224.
2024-09-06Don't leave debug locations for constants sitting on the builder indefinitely.Kyle Huey-2/+8
Because constants are currently emitted *before* the prologue, leaving the debug location on the IRBuilder spills onto other instructions in the prologue and messes up both line numbers as well as the point LLVM chooses to be the prologue end. Example LLVM IR (irrelevant IR elided): Before: define internal { i64, i64 } @_ZN3tmp3Foo18var_return_opt_try17he02116165b0fc08cE(ptr align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8, !dbg !357 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) After: define internal { i64, i64 } @_ZN3tmp3Foo18var_return_opt_try17h00b17d08874ddd90E(ptr align 8 %self) !dbg !347 { start: %self.dbg.spill = alloca [8 x i8], align 8 %_0 = alloca [16 x i8], align 8 %residual.dbg.spill = alloca [0 x i8], align 1 #dbg_declare(ptr %residual.dbg.spill, !353, !DIExpression(), !357) store ptr %self, ptr %self.dbg.spill, align 8 #dbg_declare(ptr %self.dbg.spill, !350, !DIExpression(), !358) Note in particular how !357 from %residual.dbg.spill's dbg_declare no longer falls through onto the store to %self.dbg.spill. This fixes argument values at entry when the constant is a ZST (e.g. <Option as Try>::Residual). This fixes #130003 (but note that it does *not* fix issues with argument values and non-ZST constants, which emit their own stores that have debug info on them, like #128945).
2024-09-06Do not request sanitizers for naked functionsNikita Popov-21/+25
Naked functions can only contain inline asm, so any instrumentation inserted by sanitizers is illegal. Don't request it. Fixes https://github.com/rust-lang/rust/issues/129224.
2024-09-06Rollup merge of #129969 - GrigorenkoPV:boxed-ty, r=compiler-errorsMatthias Krüger-1/+1
Make `Ty::boxed_ty` return an `Option` Looks like a good place to use Rust's type system. --- Most of https://github.com/rust-lang/rust/blob/4ac7bcbaad8d6fd7a51bdf1b696cbc3ba4c796cf/compiler/rustc_middle/src/ty/sty.rs#L971-L1963 looks like it could be moved to `TyKind` (then I guess `Ty` should be made to deref to `TyKind`).
2024-09-06Auto merge of #121614 - clubby789:no-expect, r=saethlinbors-7/+10
Don't emit `expect`/`assume` in opt-level=0 LLVM does not make use of expect/assume calls in `opt-level=0`, so we can simplify IR by not emitting them in this case.
2024-09-06Make `Ty::boxed_ty` return an `Option`Pavel Grigorenko-1/+1
2024-09-05Rollup merge of #128820 - LYF1999:yf/dev, r=nikicMatthias Krüger-1/+2
fix: get llvm type of global val using `LLVMTypeOf` on a global var always return ptr. so create a new function to access the value type of a global
2024-09-05update cfgsBoxy-1/+0
2024-09-04Remove macOS 10.10 dynamic linker bug workaroundbeetrees-52/+0