about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
AgeCommit message (Collapse)AuthorLines
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-2/+2
2022-11-21Rollup merge of #104511 - dpaoliello:privateglobalworkaround, r=michaelwoeristerMatthias Krüger-1/+14
Mark functions created for `raw-dylib` on x86 with DllImport storage class Fix for #104453 ## Issue Details On x86 Windows, LLVM uses 'L' as the prefix for any private global symbols (`PrivateGlobalPrefix`), so when the `raw-dylib` feature creates an undecorated function symbol that begins with an 'L' LLVM misinterprets that as a private global symbol that it created and so fails the compilation at a later stage since such a symbol must have a definition. ## Fix Details Mark the function we are creating for `raw-dylib` with `DllImport` storage class (this was already being done for MSVC at a later point for `callee::get_fn` but not for GNU (due to "backwards compatibility")): this will cause LLVM to prefix the name with `__imp_` and so it won't mistake it for a private global symbol.
2022-11-21Auto merge of #102717 - beetrees:repr128-c-style-debuginfo, r=nagisabors-12/+9
Pass 128-bit C-style enum enumerator values to LLVM Pass the full 128 bits of C-style enum enumerators through to LLVM. This means that debuginfo for C-style repr128 enums is now emitted correctly for DWARF platforms (as compared to not being correctly emitted on any platform). Tracking issue: #56071
2022-11-19Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3Dylan DPC-19/+53
Improve generating Custom entry function This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-18Workaround for private global symbol issueDaniel Paoliello-1/+14
2022-11-17Auto merge of #103138 - nnethercote:merge-BBs, r=bjorn3bors-5/+5
Merge basic blocks where possible when generating LLVM IR. r? `@ghost`
2022-11-16Rollup merge of #103750 - calebzulawski:master, r=workingjubileeMatthias Krüger-0/+3
Fix some misleading target feature aliases This is the first half of a fix for #100752. It looks like these aliases were added in #78361 and slipped under the radar, as these features are not AVX512. These features _do_ add AVX512 instructions when used _in combination_ with AVX512F, but without AVX512F, these features still provide 128-bit and 256-bit vector instructions. A user might be mislead into thinking these features imply AVX512F (which is true of the actual AVX512 features). This PR allows using the names as defined by LLVM, which matches Intel documentation. A future PR should change the `std::arch` intrinsics to use these names, and finally remove these aliases from rustc. r? ```@workingjubilee``` cc ```@Amanieu```
2022-11-16Use `&mut Bx` more.Nicholas Nethercote-5/+5
For the next commit, `FunctionCx::codegen_*_terminator` need to take a `&mut Bx` instead of consuming a `Bx`. This triggers a cascade of similar changes across multiple functions. The resulting code is more concise and replaces many `&mut bx` expressions with `bx`.
2022-11-15Auto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obkbors-1/+12
Perform simple scalar replacement of aggregates (SROA) MIR opt This is a re-open of https://github.com/rust-lang/rust/pull/85796 I copied the debuginfo implementation (first commit) from `@eddyb's` own SROA PR. This pass replaces plain field accesses by simple locals when possible. To be eligible, the replaced locals: - must not be enums or unions; - must not be used whole; - must not have their address taken. The storage and deinit statements are duplicated on each created local. cc `@tmiasko` who reviewed the former version of this PR.
2022-11-15Introduce composite debuginfo.Camille GILLOT-1/+12
2022-11-15Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obkbors-7/+5
interpret: support for per-byte provenance Also factors the provenance map into its own module. The third commit does the same for the init mask. I can move it in a separate PR if you prefer. Fixes https://github.com/rust-lang/miri/issues/2181 r? `@oli-obk`
2022-11-13Rollup merge of #104105 - davidtwco:split-dwarf-lto, r=michaelwoeristerManish Goregaokar-3/+13
llvm: dwo only emitted when object code emitted Fixes #103932. `CompiledModule` should not think a DWARF object was emitted when a bitcode-only compilation has happened, this can confuse archive file creation (which expects to create an archive containing non-existent dwo files). r? ``````@michaelwoerister``````
2022-11-13Rollup merge of #104357 - RalfJung:is-sized, r=cjgillotMatthias Krüger-2/+2
add is_sized method on Abi and Layout, and use it This avoids the double negation of `!is_unsized()` that we have quite a lot.
2022-11-13add is_sized method on Abi and Layout, and use itRalf Jung-2/+2
2022-11-12Update compiler/rustc_codegen_llvm/src/llvm_util.rsCaleb Zulawski-1/+1
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2022-11-12Allow actual AVX512-related feature names in the case of some misleading aliasesCaleb Zulawski-0/+3
2022-11-12Rollup merge of #104110 - krasimirgg:msan-16, r=nagisaGuillaume Gomez-3/+12
prevent uninitialized access in black_box for zero-sized-types Don't read the pointer location in black_box for zero sized types, just emit a memory clobber instead. Addresses https://github.com/rust-lang/rust/issues/103304 when rust is build against LLVM at HEAD. Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/.28with.20llvm.20at.20HEAD.29.3A.20msan.20error.20in.20core.3A.3Ahint.3A.3Ablack_box
2022-11-11Improve generating Custom entry functionAyush Singh-19/+53
This commit is aimed at making compiler generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-09Update compiler/rustc_codegen_llvm/src/back/archive.rsSLASHLogin-1/+1
Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2022-11-09Use `LayoutError`'s implementation of `IntoDiagnostic`SLASHLogin-11/+3
2022-11-09Simplify existing Diagnostic implementationsSLASHLogin-41/+49
2022-11-09Port diagnostics created by `Handler`SLASHLogin-8/+17
2022-11-09Flatten diagnostic structsSLASHLogin-48/+43
2022-11-09Port `MissingFeatures` and `TargetFeatureDisableOrEnable`SLASHLogin-14/+39
2022-11-09Port `UnknownArchiveKind`SLASHLogin-4/+11
2022-11-09Port `DlltoolFailImportLibrary` and implement `IntoDiagnosticArg` for ↵SLASHLogin-6/+17
`Cow<'a, str>`
2022-11-09Port ErrorCallingDllToolSLASHLogin-2/+10
2022-11-09Import ErrorWritingDEFFileSLASHLogin-2/+8
2022-11-09Port ArchiveBuildFailureSLASHLogin-2/+8
2022-11-09Port SanitizerMemtagRequiresMteSLASHLogin-1/+6
2022-11-09Reuse SymbolAlreadyDefinedSLASHLogin-5/+5
2022-11-09Port LinkageConstOrMutType errorSLASHLogin-9/+11
2022-11-09Port InvalidMinimumAlignmentSLASHLogin-1/+10
2022-11-09Port layout size overflowSLASHLogin-2/+11
2022-11-09Port branch protection on aarch64SLASHLogin-1/+6
2022-11-09Fix diag() and formattingSLASHLogin-2/+4
2022-11-09Port `symbol_already_defined` errorSLASHLogin-4/+10
2022-11-09Port Instrument coverage requires llvm 12 to the new structSLASHLogin-1/+6
2022-11-09Import `error creating import library`SLASHLogin-4/+12
2022-11-09Missing lifetime parameter and formattingSLASHLogin-5/+2
2022-11-09Change String in structs to &'a strSLASHLogin-6/+6
2022-11-09FormattingSLASHLogin-6/+14
2022-11-09Port unknown feature diagnostic to the new frameworkSLASHLogin-17/+37
2022-11-08Rollup merge of #103353 - wesleywiser:fix_lld_thinlto_msvc, r=michaelwoeristerManish Goregaokar-1/+3
Fix Access Violation when using lld & ThinLTO on windows-msvc Users report an AV at runtime of the compiled binary when using lld and ThinLTO on windows-msvc. The AV occurs when accessing a static value which is defined in one crate but used in another. Based on the disassembly of the cross-crate use, it appears that the use is not correctly linked with the definition and is instead assigned a garbage pointer value. If we look at the symbol tables for each crates' obj file, we can see what is happening: *lib.obj*: ``` COFF SYMBOL TABLE ... 00E 00000000 SECT2 notype External | _ZN10reproducer7memrchr2FN17h612b61ca0e168901E ... ``` *bin.obj*: ``` COFF SYMBOL TABLE ... 010 00000000 UNDEF notype External | __imp__ZN10reproducer7memrchr2FN17h612b61ca0e168901E ... ``` The use of the symbol has the "import" style symbol name but the declaration doesn't generate any symbol with the same name. As a result, linking the files generates a warning from lld: > rust-lld: warning: bin.obj: locally defined symbol imported: reproducer::memrchr::FN::h612b61ca0e168901 (defined in lib.obj) [LNK4217] and the symbol reference remains undefined at runtime leading to the AV. To fix this, we just need to detect that we are performing ThinLTO (and thus, static linking) and omit the `dllimport` attribute on the extern item in LLVM IR. Fixes #81408
2022-11-08prevent uninitialized access in black_box for zero-sized-typesKrasimir Georgiev-3/+12
2022-11-08llvm: dwo only emitted when object code emittedDavid Wood-3/+13
`CompiledModule` should not think a DWARF object was emitted when a bitcode-only compilation has happened, this can confuse archive file creation (which expects to create an archive containing non-existent dwo files). Signed-off-by: David Wood <david.wood@huawei.com>
2022-11-07Rollup merge of #104066 - TimNN:riscv-layout, r=nikicYuki Okushi-0/+4
LLVM 16: Update RISCV data layout The RISCV data layout was changed in https://github.com/llvm/llvm-project/commit/974e2e690b4024c2677dde26cc76ec31e0047c1d. This updates all `riscv64*` targets, though I don't really know what the difference between the `gc` and `imac` ones is. Passes `x test codegen` at LLVM head and with the currently bundled LLVM version. Without this patch, some tests fail with: > error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:192:13: data-layout for target `riscv64gc-unknown-none-elf`, `e-m:e-p:64:64-i64:64-i128:128-n64-S128`, differs from LLVM target's `riscv64` default layout, `e-m:e-p:64:64-i64:64-i128:128-n32:64-S128
2022-11-06LLVM 16: Update RISCV data layoutTim Neumann-0/+4
2022-11-06move InitMask to its own moduleRalf Jung-3/+1
2022-11-06interpret: support for per-byte provenanceRalf Jung-4/+4