summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm
AgeCommit message (Collapse)AuthorLines
2023-05-18Auto merge of #111364 - cuviper:unhack-thinlto, r=nikicbors-6/+0
Remove the ThinLTO CU hack This reverts #46722, commit e0ab5d5feb4eb2d8af11b8dd9446c2b45fada8af. Since #111167, commit 10b69dde3fd15334ea2382d2dc9e9a261de1afaf, we are generating DWARF subprograms in a way that is meant to be more compatible with LLVM's expectations, so hopefully we don't need this workaround rewriting CUs anymore.
2023-05-09Isolate coverage FFI type layouts from their underlying LLVM C++ typesZalathar-2/+6
2023-05-08Remove the ThinLTO CU hackJosh Stone-6/+0
This reverts #46722, commit e0ab5d5feb4eb2d8af11b8dd9446c2b45fada8af. Since #111167, commit 10b69dde3fd15334ea2382d2dc9e9a261de1afaf, we are generating DWARF subprograms in a way that is meant to be more compatible with LLVM's expectations, so hopefully we don't need this workaround rewriting CUs anymore.
2023-05-06Rollup merge of #111167 - cuviper:type-decl-disubprogram, r=michaelwoeristerMatthias Krüger-0/+15
debuginfo: split method declaration and definition When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. Now the subprogram definition gets added at the CU level with a specification link back to the abstract declaration. Both GCC and Clang write debuginfo this way for C++ class methods. Fixes #109730. Fixes #109934.
2023-05-04moved default CPU message inlineJames Dietz-1/+1
2023-05-03debuginfo: split method declaration and definitionJosh Stone-0/+15
When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. Now the subprogram definition gets added at the CU level with a specification link back to the abstract declaration.
2023-04-19Recognize AIX style archive kindQiu Chaofan-0/+2
2023-04-08Auto merge of #109862 - klensy:llvm-dd, r=nikicbors-17/+25
llvm: replace some deprecated functions, add fixmes Replace some deprecated llvm functions, add FIXME's (for simpler future work), replace some rust custom functions with llvm ones.
2023-04-08fixup: use Bool instead of boolklensy-1/+1
2023-04-05reviewklensy-2/+1
2023-04-04replaceklensy-2/+3
LLVMRustBuildIntCast -> LLVMBuildIntCast2 LLVMRustAddHandler -> LLVMAddHandler
2023-04-04Use existing llvm methods, instead of rust wrappers for:klensy-10/+10
LLVMRustBuildCleanupPad -> LLVMBuildCleanupPad LLVMRustBuildCleanupRet -> LLVMBuildCleanupRet LLVMRustBuildCatchPad -> LLVMBuildCatchPad LLVMRustBuildCatchRet -> LLVMBuildCatchRet LLVMRustBuildCatchSwitch -> LLVMBuildCatchSwitch
2023-04-04replace LLVMRustAppendModuleInlineAsm with LLVMAppendModuleInlineAsm, ↵klensy-2/+2
LLVMRustMetadataTypeInContext with LLVMMetadataTypeInContext
2023-04-04replace LLVMRustMetadataAsValue with LLVMMetadataAsValueklensy-1/+1
2023-04-04add bunch of fixmes: currently there exist some functions that accept ↵klensy-0/+8
LLVMValueRef, some that accept LLVMMetadataRef, and replacing one with another not always possible without explicit convertion
2023-04-04replace deprecated LLVMSetCurrentDebugLocation with LLVMSetCurrentDebugLocation2klensy-1/+1
2023-03-31More in-depth documentation for the new debuginfo optionsJulia Tatz-0/+10
2023-03-31Preserve, clarify, and extend debug informationJulia Tatz-2/+4
`-Cdebuginfo=1` was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for line tables only was added. Additionally an option for line info directives only was added, which is well needed for some targets. The debug info options should now behave the same as clang's debug info options.
2023-03-28Add OpenHarmony targetsAmanieu d'Antras-0/+1
- `aarch64-unknown-linux-ohos` - `armv7-unknown-linux-ohos`
2023-03-16Use poison instead of undefNikita Popov-0/+1
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-06Remove references to PassManagerBuilderNikita Popov-3/+0
This is a legacy PM concept that we no longer use.
2023-03-03Rollup merge of #108599 - nikic:drop-init, r=cuviperMatthias Krüger-2/+0
Remove legacy PM leftovers This drops two leftovers of legacy PM usage: * We don't need to initialize passes anymore. * The pass listing was still using legacy PM passes. Replace it with the corresponding new PM listing.
2023-03-01Remove pass initialization codeNikita Popov-2/+0
This is no longer necessary with the new pass manager.
2023-02-25record llvm cgu instruction statscsmoe-0/+2
2023-02-14Add `kernel-address` sanitizer support for freestanding targetsWesley Norris-0/+2
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-3/+3
rustc: Remove needless lifetimes
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-3/+3
2022-12-19Correct ModFlagBehavior for Aarch64 on LLVM-15Arvind Mukund-0/+1
When building with Fat LTO and BTI enabled on aarch64, the BTI is set to `Module::Min` for alloc shim but is set to `Module::Error` for the crate. This was fine when we were using LLVM-14 but LLVM-15 changes it's behaviour to support for compiling with different `mbranch-protection` flags. Refer: https://github.com/rust-lang/llvm-project/commit/b0343a38a5910e980bb031e4014655d77cd0c162
2022-12-10Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3Matthias Krüger-2/+6
Add LLVM KCFI support to the Rust compiler This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-08Add LLVM KCFI support to the Rust compilerRamon de C Valle-2/+6
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-12-03Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiserbors-0/+13
Rewrite LLVM's archive writer in Rust This allows it to be used by other codegen backends. Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-1/+1
2022-11-26Rewrite LLVM's archive writer in Rustbjorn3-0/+13
This allows it to be used by other codegen backends
2022-11-21Auto merge of #102717 - beetrees:repr128-c-style-debuginfo, r=nagisabors-1/+2
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-15Introduce composite debuginfo.Camille GILLOT-0/+1
2022-11-04LLVM 16: Switch to using MemoryEffectsTim Neumann-1/+17
2022-10-09Pass 128-bit C-style enum enumerator values to LLVMbeetrees-1/+2
2022-09-25Rollup merge of #101997 - cuviper:drop-legacy-pm, r=nikicfee1-dead-72/+2
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-18Use LLVM C-API to build atomic cmpxchg and fenceJosh Stone-27/+9
2022-09-18Remove support for LLVM's legacy pass managerJosh Stone-72/+2
2022-09-09Introduce a fallible variant of LLVMConstIntGetZExtValueTomasz Miąsko-1/+1
which verifies that a constant bit width is within 64 bits or fails.
2022-08-30Auto merge of #98100 - bjorn3:use_object_for_bitcode_reading, r=wesleywiserbors-12/+0
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-16Rollup merge of #100460 - cuviper:drop-llvm-12, r=nagisaMatthias Krüger-6/+0
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/+1
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-14Update the minimum external LLVM to 13Josh Stone-6/+0
2022-08-12debuginfo: Change C++-like encoding for enums.Michael Woerister-0/+13
The updated encoding should be able to handle niche layouts where more than one variant has fields.
2022-08-11Add support for generating unique *.profraw files by default when using the ↵ridwanabdillahi-0/+1
`-C instrument-coverage` flag. Respond to PR comments.
2022-07-27Add elementtype attributes for llvm.arm.ldrex/strex intrinsicsNikita Popov-0/+3
These intrinsics (and a few more, but there are the only ones exposed by stdarch) require an elementtype attribute in LLVM 15.
2022-07-27Rollup merge of #99759 - bjorn3:remove_llvm_dead_code, r=nikicYuki Okushi-46/+0
Remove dead code from cg_llvm Found while working on https://github.com/rust-lang/rust/pull/97485
2022-07-26codegen: use new {re,de,}allocator annotations in llvmAugie Fackler-0/+29
This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. While we're here, we also emit allocator attributes on __rust_alloc_zeroed. This should allow LLVM to perform more optimizations for zeroed blocks, and probably fixes #90032. [This comment](https://github.com/rust-lang/rust/issues/24194#issuecomment-308791157) mentions "weird UB-like behaviour with bitvec iterators in rustc_data_structures" so we may need to back this change out if things go wrong. The new test cases require LLVM 15, so we copy them into LLVM 14-supporting versions, which we can delete when we drop LLVM 14.