summaryrefslogtreecommitdiff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Auto merge of #111364 - cuviper:unhack-thinlto, r=nikicHEADmasterbors2023-05-181-57/+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.
| * Remove the ThinLTO CU hackJosh Stone2023-05-081-57/+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.
* | Usage of atomic counters for llvm code coverageEvgeniy A. Dushistov2023-05-121-0/+3
|/
* Expand the LLVM coverage of `--print target-cpus`Josh Stone2023-05-051-14/+16
| | | | | | | | | | | | We've been relying on a custom patch to add `MCSubtargetInfo::getCPUTable` for `rustc --print target-cpus`, and just printing that it's not supported on external LLVM builds. LLVM `main` now has `getAllProcessorDescriptions` that can replace ours, so now we try to use that. In addition, the fallback path can at least print the native and default cpu options. There were also some mismatches in the function signatures here between `LLVM_RUSTLLVM` and otherwise; this is now mitigated by sharing these functions and only using cpp to adjust the function bodies.
* change expect() to unwrap_or_else() and update msgJames Dietz2023-05-041-2/+6
|
* moved default CPU message inlineJames Dietz2023-05-041-9/+7
|
* `--print target-cpus` shows default target cpu, updated docsJames Dietz2023-05-041-2/+9
|
* [LLVM17] Adapt to `ExplicitEmulatedTLS` removal.Tim Neumann2023-04-241-0/+5
|
* Rollup merge of #110668 - ehuss:fix-native-cpu-list, r=cuviperMatthias Krüger2023-04-231-1/+3
|\ | | | | | | | | | | | | | | Fix printing native CPU on cross-compiled compiler. If `rustc` is cross-compiled from a different host, then the "native" entry in `rustc --print=target-cpus` would not appear. There is a check in the printing code that will avoid printing the "native" entry if the user has passed `--target`. However, that check was comparing the `--target` value with the `LLVM_TARGET_TRIPLE` which is the triple of the host that `rustc` was built on (the "build" target in Rust lingo), not the target it was being built for (the "host" in Rust lingo). This fixes it to use the target that LLVM was built for (which I'm pretty sure this is the correct function to determine that). This fixes the cpu listing for aarch64-apple-darwin which is built on CI using the x86_64-apple-darwin host.
| * Fix printing native CPU on cross-compiled compiler.Eric Huss2023-04-231-1/+3
| |
* | Remove deprecated LLVM any_isaQiu Chaofan2023-04-201-8/+8
|/
* Spelling - compilerJosh Soref2023-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
* Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiserMichael Goulet2023-04-111-0/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial support for loongarch64-unknown-linux-gnu Hi, We hope to add a new port in rust for LoongArch. LoongArch intro LoongArch is a RISC style ISA which is independently designed by Loongson Technology in China. It is divided into two versions, the 32-bit version (LA32) and the 64-bit version (LA64). LA64 applications have application-level backward binary compatibility with LA32 applications. LoongArch is composed of a basic part (Loongson Base) and an expanded part. The expansion part includes Loongson Binary Translation (LBT), Loongson VirtualiZation (LVZ), Loongson SIMD EXtension (LSX) and Loongson Advanced SIMD EXtension(LASX). Currently the LA464 processor core supports LoongArch ISA and the Loongson 3A5000 processor integrates 4 64-bit LA464 cores. LA464 is a four-issue 64-bit high-performance processor core. It can be used as a single core for high-end embedded and desktop applications, or as a basic processor core to form an on-chip multi-core system for server and high-performance machine applications. Documentations: ISA: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html ABI: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html More docs can be found at: https://loongson.github.io/LoongArch-Documentation/README-EN.html Since last year, we have locally adapted two versions of rust, rust1.41 and rust1.57, and completed the test locally. I'm not sure if I'm submitting all the patches at once, so I split up the patches and here's one of the commits
| * Enable loongarch64 LLVM targetzhaixiaojuan2023-04-041-0/+7
| |
* | Auto merge of #109720 - Dylan-DPC:rollup-u564m8s, r=Dylan-DPCbors2023-03-291-7/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rollup of 7 pull requests Successful merges: - #108335 (rustdoc + rustdoc-json support for `feature(non_lifetime_binders)`) - #109534 (rustdoc: Unsupport importing `doc(primitive)` and `doc(keyword)` modules) - #109659 (llvm-wrapper: adapt for LLVM API change) - #109664 (Use span of placeholders in format_args!() expansion.) - #109683 (Check for overflow in `assemble_candidates_after_normalizing_self_ty`) - #109713 (Fix mismatched punctuation in Debug impl of AttrId) - #109718 (Rename `IndexVec::last` → `last_index`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
| * | llvm-wrapper: adapt for LLVM API changeKrasimir Georgiev2023-03-271-7/+10
| |/ | | | | | | Adapts the wrapper for the LLVM commit https://github.com/llvm/llvm-project/commit/377e1311d50c7e5b5aab3db081938e0d0ceebdfc.
* | Add OpenHarmony targetsAmanieu d'Antras2023-03-281-1/+6
|/ | | | | - `aarch64-unknown-linux-ohos` - `armv7-unknown-linux-ohos`
* Remove references to PassManagerBuilderNikita Popov2023-03-061-2/+0
| | | | This is a legacy PM concept that we no longer use.
* Print NewPM passesNikita Popov2023-03-011-16/+2
| | | | | -C passes=list was printing passes for the legacy pass manager. Use PassBuilder::printPassNames() to print NewPM passes instead.
* Remove pass initialization codeNikita Popov2023-03-011-18/+0
| | | | This is no longer necessary with the new pass manager.
* Add `kernel-address` sanitizer support for freestanding targetsWesley Norris2023-02-141-3/+7
|
* Update the minimum external LLVM to 14Josh Stone2023-02-101-41/+3
|
* llvm-wrapper: adapt for LLVM API changesKrasimir Georgiev2023-02-021-8/+30
| | | | | | | | Adapts the wrapper for https://github.com/llvm/llvm-project/commit/516e301752560311d2cd8c2b549493eb0f98d01b, where the constructor of PGOOptions gained a new FileSystem argument. Adapted to use the real file system, similarly to the changes inside of LLVM: https://github.com/llvm/llvm-project/commit/516e301752560311d2cd8c2b549493eb0f98d01b#diff-f409934ba27ad86494f3012324e9a3995b56e0743609ded7a387ba62bbf5edb0R236
* Remove double spaces after dots in commentsMaybe Waffle2023-01-171-2/+2
|
* llvm-wrapper: adapt for LLVM API changesKrasimir Georgiev2022-12-111-0/+4
| | | | | | | | | | This is a follow-up of https://github.com/rust-lang/rust/commit/75aec4703dea7ef8e13924ccfa3a3d2e8c5c7cff. There, I updated the wrapper to only include llvm/ADT/Optional.h for LLVM version below 16. But I missed updating some of the None references. Found by our experimental rust + llvm at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
* llvm-wrapper: adapt for and LLVM API changeKrasimir Georgiev2022-12-061-1/+10
|
* [llvm-wrapper] adapt for LLVM API changeKrasimir Georgiev2022-11-251-0/+4
| | | | | Adapt for the LLVM API changes from https://github.com/llvm/llvm-project/commit/721f975d3518403502f770ce11f3f02509b30c5b#diff-5a347903b8412ed1b1b1948c3fce47f9a6ff05dc70bfaeedb6d06b622e399d91.
* Throw error on failure in loading llvm-pluginDivam Narula2022-11-171-1/+1
|
* llvm-16: Don't initialize removed legacy passesMatthew Maurer2022-10-251-0/+2
| | | | | LLVM removed initialization for legacy passes: https://reviews.llvm.org/D136615
* Avoid LLVM-deprecated `Optional::hasValue`Josh Stone2022-09-261-1/+1
| | | | | | | LLVM 15 added `Optional::has_value`, and LLVM `main` (16) has deprecated `hasValue`. However, its `explicit operator bool` does the same thing, and was added long ago, so we can use that across our full LLVM range of compatibility.
* Use the helper for internalizing with new PMJosh Stone2022-09-181-5/+2
|
* Never use legacy PM for writing bitcodeJosh Stone2022-09-181-12/+2
|
* Remove support for LLVM's legacy pass managerJosh Stone2022-09-181-234/+1
|
* Rollup merge of #99207 - 5225225:msan-eager-checks, r=jackh726Matthias Krüger2022-09-091-1/+14
|\ | | | | | | | | | | Enable eager checks for memory sanitizer Fixes #99179
| * Enable eager checks for memory sanitizer52252252022-08-141-1/+14
| |
* | llvm-wrapper: adapt for LLVM API changesKrasimir Georgiev2022-09-071-1/+7
| | | | | | | | | | | | | | | | | | No functional changes intended. Adapts PassWrapper for two recent LLVM API changes: * https://github.com/llvm/llvm-project/commit/e7bac3b9fa739f8d167a390a547068aad1d424a7 * https://github.com/llvm/llvm-project/commit/93600eb50ceeec83c488ded24fa0fd25f997fec6 * https://github.com/llvm/llvm-project/commit/5e38b2a456df6e263a509af60a731cec57310498
* | llvm-wrapper: use new pass manager for thin lto with LLVM version 15Krasimir Georgiev2022-08-171-2/+23
| | | | | | | | | | | | | | No functional changes intended. LLVM commit https://github.com/llvm/llvm-project/commit/633f5663c37a670e28040cadd938200abd854483 removed `createWriteThinLTOBitcodePass`. This adapts PassWrapper similarly to the example mentioned upstream: https://github.com/llvm/llvm-project/commit/633f5663c37a670e28040cadd938200abd854483.
* | Rollup merge of #100460 - cuviper:drop-llvm-12, r=nagisaMatthias Krüger2022-08-161-17/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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`
| * | Update the minimum external LLVM to 13Josh Stone2022-08-141-17/+1
| |/
* | Add support for generating unique *.profraw files by default when using the ↵ridwanabdillahi2022-08-111-2/+6
|/ | | | | | `-C instrument-coverage` flag. Respond to PR comments.
* Remove dead code from cg_llvmbjorn32022-07-261-45/+0
|
* Auto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwcobors2022-07-211-2/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to disable thinLTO buffer to support lto-embed-bitcode lld feature Hello This change is to fix issue (https://github.com/rust-lang/rust/issues/84395) in which passing "-lto-embed-bitcode=optimized" to lld when linking rust code via linker-plugin-lto doesn't produce the expected result. Instead of emitting a single unified module into a llvmbc section of the linked elf, it emits multiple submodules. This is caused because rustc emits the BC modules after running llvm `createWriteThinLTOBitcodePass` pass. Which in turn triggers a thinLTO linkage and causes the said issue. This patch allows via compiler flag (-Cemit-thin-lto=<bool>) to select between running `createWriteThinLTOBitcodePass` and `createBitcodeWriterPass`. Note this pattern of selecting between those 2 passes is common inside of LLVM code. The default is to match the old behavior.
| * rustc: add ability to output regular LTO bitcode modulesZiv Dunkelman2022-07-141-2/+7
| | | | | | | | | | | | | | | | | | | | | | Adding the option to control from rustc CLI if the resulted ".o" bitcode module files are with thinLTO info or regular LTO info. Allows using "-lto-embed-bitcode=optimized" during linkage correctly. Signed-off-by: Ziv Dunkelman <ziv.dunkelman@nextsilicon.com>
* | Auto merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelixbors2022-07-161-2/+2
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "Work around invalid DWARF bugs for fat LTO" Since September, the toolchain has not been generating reliable DWARF information for static variables when LTO is on. This has affected projects in the embedded space where the use of LTO is typical. In our case, it has kept us from bumping past the 2021-09-22 nightly toolchain lest our debugger break. This has been a pretty dramatic regression for people using debuggers and static variables. See #90357 for more info and a repro case. This commit is a mechanical revert of d5de680e20def848751cb3c11e1182408112b1d3 from PR #89041, which caused the issue. (Note on that PR that the commit's author has requested it be reverted.) I have locally verified that this fixes #90357 by restoring the functionality of both the repro case I posted on that bug, and debugger behavior on real programs. There do not appear to be test cases for this in the toolchain; if I've missed them, point me at 'em and I'll update them.
| * Revert "Work around invalid DWARF bugs for fat LTO"Cliff L. Biffle2022-04-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since September, the toolchain has not been generating reliable DWARF information for static variables when LTO is on. This has affected projects in the embedded space where the use of LTO is typical. In our case, it has kept us from bumping past the 2021-09-22 nightly toolchain lest our debugger break. This has been a pretty dramatic regression for people using debuggers and static variables. See #90357 for more info and a repro case. This commit is a mechanical revert of d5de680e20def848751cb3c11e1182408112b1d3 from PR #89041, which caused the issue. (Note on that PR that the commit's author has requested it be reverted.) I have locally verified that this fixes #90357 by restoring the functionality of both the repro case I posted on that bug, and debugger behavior on real programs. There do not appear to be test cases for this in the toolchain; if I've missed them, point me at 'em and I'll update them.
* | llvm-wrapper: adapt for an LLVM API changeKrasimir Georgiev2022-06-281-0/+2
| | | | | | | | | | | | This adapts llvm-wrapper for https://github.com/llvm/llvm-project/commit/dacfa24f75c328ae30b710ecadaa18e4ba10cdc6, which removed ASanGlobalsMetadataAnalysis.
* | Stub out more PassManagerBuilder functionsNikita Popov2022-04-201-1/+52
| |
* | Stub out various legacy PM functions with LLVM 15Nikita Popov2022-04-201-0/+44
| |
* | Respect -Z verify-llvm-ir and other flags that add extra passes when ↵Luqman Aden2022-04-101-0/+7
|/ | | | combined with -C no-prepopulate-passes in the new LLVM Pass Manager.
* Remove LLVMRustMarkAllFunctionsNounwindAmanieu d'Antras2022-01-141-19/+0
| | | | | | | | | | | This was originally introduced in #10916 as a way to remove all landing pads when performing LTO. However this is no longer necessary today since rustc properly marks all functions and call-sites as nounwind where appropriate. In fact this is incorrect in the presence of `extern "C-unwind"` which must create a landing pad when compiled with `-C panic=abort` so that foreign exceptions are caught and properly turned into aborts.