about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
AgeCommit message (Collapse)AuthorLines
2023-03-22Add `CastKind::Transmute` to MIRScott McMurray-85/+60
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
2023-03-22Rollup merge of #109378 - MU001999:master, r=scottmcmMatthias Krüger-2/+2
Remove Ty::is_region_ptr Fixes #109372
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-3/+4
2023-03-21Remove `unique` and move `VerboseTimingGuard` fields into a new structJohn Kåre Alsaker-1/+0
2023-03-21Add `-Z time-passes-format` to allow specifying a JSON output for `-Z ↵John Kåre Alsaker-0/+2
time-passes`
2023-03-21LocalCrate keyMichael Goulet-2/+3
2023-03-21Use local key in providersMichael Goulet-10/+5
2023-03-20Rollup merge of #109307 - cjgillot:inline-location, r=compiler-errorsMatthias Krüger-1/+5
Ignore `Inlined` spans when computing caller location. Fixes https://github.com/rust-lang/rust/issues/105538
2023-03-20Remove Ty::is_region_ptrMu42-2/+2
2023-03-19Rollup merge of #109243 - chenyukang:yukang/fix-ice-109144, r=petrochenkovDylan DPC-12/+11
The name of NativeLib will be presented Fixes #109144 I was working on a quick fix, but found change the name from `Option<Symbol>` to `Symbol` make life a little bit easier.
2023-03-19The name of NativeLib will be presentedyukang-12/+11
2023-03-18Ignore `Inlined` spans when computing caller location.Camille GILLOT-1/+5
2023-03-18Rollup merge of #109287 - scottmcm:hash-slice-size-of-val, r=oli-obkMatthias Krüger-1/+1
Use `size_of_val` instead of manual calculation Very minor thing that I happened to notice in passing, but it's both shorter and [means it gets `mul nsw`](https://rust.godbolt.org/z/Y9KxYETv5), so why not.
2023-03-18Rollup merge of #109234 - tmiasko:overflow-checks, r=cjgillotMatthias Krüger-9/+2
Tweak implementation of overflow checking assertions Extract and reuse logic controlling behaviour of overflow checking assertions instead of duplicating it three times. r? `@cjgillot`
2023-03-17Use `size_of_val` instead of manual calculationScott McMurray-1/+1
Very minor thing that I happened to notice in passing, but it's both shorter and means it gets `mul nuw`, so why not.
2023-03-17Rollup merge of #109156 - taiki-e:linker-detection, r=petrochenkovMatthias Krüger-1/+3
Fix linker detection for clang with prefix https://github.com/rust-lang/rust/pull/106489 removed check for clang with prefix. It says: > Also remove the check for -clang, since there are no architecture specific variants of clang (to my knowledge). However, when doing cross-compilation, a wrapper script for clang with the target name as a prefix is sometimes used. https://github.com/rust-lang/rust/blob/1716932743a7b3705cbf0c34db0c4e070ed1930d/src/ci/docker/host-x86_64/dist-various-2/Dockerfile#L62 https://github.com/rust-lang/rust/blob/1716932743a7b3705cbf0c34db0c4e070ed1930d/src/ci/docker/scripts/freebsd-toolchain.sh#L76-L80 https://github.com/rust-lang/rust/blob/1716932743a7b3705cbf0c34db0c4e070ed1930d/src/ci/docker/host-x86_64/dist-various-2/Dockerfile#L40 https://github.com/rust-lang/rust/blob/1716932743a7b3705cbf0c34db0c4e070ed1930d/compiler/rustc_target/src/spec/aarch64_pc_windows_gnullvm.rs#L7 It seems the regression did not occur on the targets mentioned above because the default linker flavor is gcc, but it did occur on targets where the default linker flavor is not gcc (https://github.com/taiki-e/setup-cross-toolchain-action/commit/fd352f3ffabd00daf2759ab4a3276729e52eeb10). r? ````@petrochenkov````
2023-03-16Tweak implementation of overflow checking assertionsTomasz Miąsko-9/+2
Extract and reuse logic controlling behaviour of overflow checking assertions instead of duplicating it three times.
2023-03-16Auto merge of #108944 - cjgillot:clear-local-info, r=oli-obkbors-7/+2
Wrap the whole LocalInfo in ClearCrossCrate. MIR contains a lot of information about locals. The primary purpose of this information is the quality of borrowck diagnostics. This PR aims to drop this information after MIR analyses are finished, ie. starting from post-cleanup runtime MIR.
2023-03-16Use poison instead of undefNikita Popov-4/+5
In cases where it is legal, we should prefer poison values over undef values. This replaces undef with poison for aggregate construction and for uninhabited types. There are more places where we can likely use poison, but I wanted to stay conservative to start with. In particular the aggregate case is important for newer LLVM versions, which are not able to handle an undef base value during early optimization due to poison-propagation concerns.
2023-03-15Auto merge of #108282 - cjgillot:mir-checked-sh, r=tmiaskobors-11/+0
Implement checked Shl/Shr at MIR building. This does not require any special handling by codegen backends, as the overflow behaviour is entirely determined by the rhs (shift amount). This allows MIR ConstProp to remove the overflow check for constant shifts. ~There is an existing different behaviour between cg_llvm and cg_clif (cc `@bjorn3).` I took cg_llvm's one as reference: overflow if `rhs < 0 || rhs > number_of_bits_in_lhs_ty`.~ EDIT: `cg_llvm` and `cg_clif` implement the overflow check differently. This PR uses `cg_llvm`'s implementation based on a `BitAnd` instead of `cg_clif`'s one based on an unsigned comparison.
2023-03-15Account for debuginfo on _0 without naming it.Camille GILLOT-6/+2
2023-03-15Fix linker detection for clang with prefixTaiki Endo-1/+3
2023-03-14ICE when checking LocalInfo on runtime MIR.Camille GILLOT-2/+1
2023-03-14Further codegen_attrs cleanupsNilstrieb-63/+62
2023-03-14Use match instead of if in codegen_attrsNilstrieb-275/+309
2023-03-13Rollup merge of #109088 - Nilstrieb:target-feature-on-statics-when, ↵Matthias Krüger-20/+25
r=compiler-errors Gracefully handle `#[target_feature]` on statics The was careful around not calling `fn_sig` on not-functions but well, it wasn't careful enough. This commit makes it a little more careful and also adds tests for a bunch more item kinds. I was sadly not able to fully bless the test locally because I'm on an aarch64 machine but I hope some manual editing made it work 😅 Fix #109079
2023-03-13Gracefully handle `#[target_feature]` on staticsNilstrieb-20/+25
The was careful around not calling `fn_sig` on not-functions but well, it wasn't careful enough. This commit makes it a little more careful and also adds tests for a bunch more item kinds.
2023-03-12Allow `#[target_feature]` on `main` and `start` for WASMLéo Lanteri Thauvin-0/+3
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11Rollup merge of #108739 - 823984418:patch-1, r=cjgillotMatthias Krüger-0/+4
Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time Here, at the same time, there are two `start_llbb` builder, this should be unexpected.
2023-03-11Auto merge of #109001 - matthiaskrgr:rollup-a3agnwp, r=matthiaskrgrbors-24/+29
Rollup of 8 pull requests Successful merges: - #105798 (Relax ordering rules for `asm!` operands) - #105962 (Stabilize path_as_mut_os_str) - #106085 (use problem matchers for tidy CI) - #107711 (Stabilize movbe target feature) - #108017 (Add `--no-undefined-version` link flag and fix associated breakage) - #108891 (Remove an extraneous include) - #108902 (no more do while :<) - #108912 (Document tool lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-10Rollup merge of #108017 - chbaker0:fix-105967, r=chbaker0Matthias Krüger-22/+28
Add `--no-undefined-version` link flag and fix associated breakage LLVM upstream sets `--no-undefined-version` by default in lld: https://reviews.llvm.org/D135402. Due to a bug in how version scripts are generated, this breaks the `dylib` output type for most crates. See https://github.com/rust-lang/rust/issues/105967#issuecomment-1428671533 for details. This PR adds the flag to gcc flavor linkers in anticipation of this LLVM change rolling in, and patches `rustc` to not attempt to export `__rust_*` allocator symbols when they weren't generated. Fixes #105967
2023-03-10Rollup merge of #107711 - calebzulawski:movbe, r=pnkfelixMatthias Krüger-2/+1
Stabilize movbe target feature Almost all "old" x86 target features are stable. As far as I can tell, these are the last two unstable features in the `x86-64-v2` or `x86-64-v3` microarchitecture levels, so I'm not sure if it was an oversight or if they're still unstable for a reason (see #106323 for `f16c`). Note that this only stabilizes the target features, and not the intrinsics. cc ```@Amanieu``` r? ```@rust-lang/lang```
2023-03-10Rollup merge of #108983 - ↵Matthias Krüger-1/+1
LeSeulArtichaut:108646-target-feature-default-impl, r=cjgillot Forbid `#[target_feature]` on safe default implementations Fixes #108646.
2023-03-10Forbid `#[target_feature]` on safe default implementationsLéo Lanteri Thauvin-1/+1
2023-03-09Don't export of __rust_* alloc symbols if not codegenedCollin Baker-22/+27
2023-03-09Add soon-to-be-default --no-undefined-version flagCollin Baker-0/+1
2023-03-09Introduce a no-op PlaceMention statement for `let _ =`.Camille GILLOT-0/+1
2023-03-08Rollup merge of #108856 - Zeegomo:remove-drop-and-rep, r=tmiaskoMatthias Krüger-5/+0
Remove DropAndReplace terminator #107844 made DropAndReplace unused, let's remove it completely from the codebase.
2023-03-08Auto merge of #108312 - michaelwoerister:hash-set-not-hash-stable, r=eholkbors-4/+4
Do not implement HashStable for HashSet (MCP 533) This PR removes all occurrences of `HashSet` in query results, replacing it either with `FxIndexSet` or with `UnordSet`, and then removes the `HashStable` implementation of `HashSet`. This is part of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), that is, removing the `HashStable` implementations of all collection types with unstable iteration order. The changes are mostly mechanical. The only place where additional sorting is happening is in Miri's override implementation of the `exported_symbols` query.
2023-03-08Add a comment about drop(start_bx)823984418-0/+2
2023-03-07Remove DropAndReplace terminatorGiacomo Pasini-5/+0
PR 107844 made DropAndReplace unused, let's remove it completely from the codebase.
2023-03-05Auto merge of #108351 - petrochenkov:rmdit, r=cjgillotbors-3/+3
rustc_middle: Remove trait `DefIdTree` This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-05Auto merge of #101550 - CraftSpider:link-dead-windows, r=wesleywiserbors-0/+6
Make compressed rmeta contain compressed data length after header Fixes #90056, which is caused by link.exe introducing padding to the `.rustc` section, since it assumes this will have no effect besides allowing it to possibly use the extra space in future links.
2023-03-04Prevent the `start_bx` basic block in codegen from having two `Builder`s at ↵823984418-0/+2
the same time
2023-03-02Stabilize movbe target featureCaleb Zulawski-2/+1
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-3/+3
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-02Revert "Stabilize `#![feature(target_feature_11)]`"Léo Lanteri Thauvin-18/+29
This reverts commit b379d216eefaba083a0627b1724d73f99d4bdf5c.
2023-03-01Use FxIndexSet instead of FxHashSet for asm_target_features query.Michael Woerister-2/+2
2023-03-01Use LocalDefIdSet instead of FxHashSet for reachable_set query.Michael Woerister-2/+2