about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
AgeCommit message (Collapse)AuthorLines
2024-03-12llvm-wrapper: adapt for LLVM API changesKrasimir Georgiev-2/+7
Adapts rust for https://github.com/llvm/llvm-project/commit/9997e0397156ff7e01aecbd17bdeb7bfe5fb15b0.
2024-03-10Fix 32-bit overflows in LLVM composite constantserer1243-8/+34
2024-03-08Rollup merge of #122143 - durin42:llvm-19-compression-options, r=workingjubileeMatthias Krüger-0/+16
PassWrapper: update for llvm/llvm-project@a3319371970b ``@rustbot`` label: +llvm-main
2024-03-08Rollup merge of #119365 - nbdd0121:asm-goto, r=AmanieuMatthias Krüger-0/+25
Add asm goto support to `asm!` Tracking issue: #119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2024-03-07PassWrapper: update for llvm/llvm-project@a3319371970bAugie Fackler-0/+16
@rustbot label: +llvm-main
2024-03-07Rollup merge of #122062 - workingjubilee:initialize-my-fist, r=cuviperMatthias Krüger-52/+53
Explicitly assign constructed C++ classes C++ style guides I am aware of recommend specifically preferring = syntax for any classes with fairly obvious constructors[^0] that do not perform any complicated logic in their constructor. I contend that all constructors that the `rustc_llvm` code uses qualify. This has only become more common since C++ 17 guaranteed many cases of copy initialization elision. The other detail is that I tried to ask another contributor with infinitely more C++ experience than me (i.e. any) what this constructor syntax was, and they thought it was a macro. I know of no other language that has adopted this same syntax. As the rustc codebase features many contributors experienced in many other languages, using a less... unique... style has many other benefits in making this code more lucid and maintainable, which is something it direly needs. [^0]: e.g. https://abseil.io/tips/88
2024-03-05Explicitly assign constructed C++ classesJubilee Young-52/+53
C++ style guides I am aware of recommend specifically preferring = syntax for any classes with fairly obvious constructors[^0] that do not perform any complicated logic in their constructor. I contend that all constructors that the `rustc_llvm` code uses qualify. This has only become more common since C++ 17 guaranteed many cases of copy initialization elision. The other detail is that I tried to ask another contributor with infinitely more C++ experience than me (i.e. any) what this constructor syntax was, and they thought it was a macro. I know of no other language that has adopted this same syntax. As the rustc codebase features many contributors experienced in many other languages, using a less... unique... style has many other benefits in making this code more lucid and maintainable, which is something it direly needs. [^0]: e.g. https://abseil.io/tips/88
2024-03-05Clarify FatalErrorHandlerJubilee Young-2/+12
Clarify the FatalErrorHandler API that we use: - Identify rustc's LLVM ERRORs by prefixing them - Comment heavily on its interior, while we are here
2024-03-01Add initial support for DataFlowSanitizerRamon de C Valle-0/+16
Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-02-26Rollup merge of #121389 - klensy:llvm-warn-fix, r=nikicMatthias Krüger-2/+2
llvm-wrapper: fix few warnings Two fixes: first one is simple unsigned -> uint64_t, but how second one is more subtile, see commit description.
2024-02-24Add callbr support to LLVM wrapperGary Guo-0/+25
2024-02-21remove simd_reduce_{min,max}_nanlessRalf Jung-7/+6
2024-02-21make simd_reduce_{mul,add}_unordered use only the 'reassoc' flag, not all ↵Ralf Jung-0/+15
fast-math flags
2024-02-21llvm-wrapper: fix warning C4305klensy-1/+1
llvm-wrapper/ArchiveWrapper.cpp(70): warning C4305: 'argument': truncation from 'int' to 'bool' while in llvm 12 signature was static ErrorOr<std::unique_ptr<MemoryBuffer>> getFile(const Twine &Filename, int64_t FileSize = -1, bool RequiresNullTerminator = true, bool IsVolatile = false); https://github.com/llvm/llvm-project/blame/fed41342a82f5a3a9201819a82bf7a48313e296b/llvm/include/llvm/Support/MemoryBuffer.h#L85-L87 in llvm 13 and later it was changed to static ErrorOr<std::unique_ptr<MemoryBuffer>> getFile(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true, bool IsVolatile = false); https://github.com/llvm/llvm-project/blame/75e33f71c2dae584b13a7d1186ae0a038ba98838/llvm/include/llvm/Support/MemoryBuffer.h#L86-L88 so code was interpreted as MemoryBuffer::getFile(Path, /*IsText*/true, /*RequiresNullTerminator=*/false), but now will be MemoryBuffer::getFile(Path, /*IsText*/false, /*RequiresNullTerminator=*/false). How that worked before?
2024-02-21llvm-wrapper: fix warning C4244klensy-1/+1
llvm-wrapper/RustWrapper.cpp(1234): warning C4244: '=': conversion from 'uint64_t' to 'unsigned int', possible loss of data nice consistency: uint64_t https://github.com/llvm/llvm-project/blob/6009708b4367171ccdbf4b5905cb6a803753fe18/llvm/include/llvm/IR/DiagnosticInfo.h#L172 but unsigned https://github.com/llvm/llvm-project/blob/6009708b4367171ccdbf4b5905cb6a803753fe18/llvm/include/llvm/IR/DiagnosticInfo.h#L1091
2024-02-20Add "algebraic" versions of the fast-math intrinsicsBen Kimock-1/+24
2024-02-13Auto merge of #121036 - matthiaskrgr:rollup-ul05q8e, r=matthiaskrgrbors-1/+1
Rollup of 8 pull requests Successful merges: - #114877 (unstable-book: add quick-edit link) - #120548 (rustdoc: Fix handling of doc_auto_cfg feature for cfg attributes on glob reexport) - #120549 (modify alias-relate to also normalize ambiguous opaques) - #120959 (Remove good path delayed bugs) - #120978 (match lowering: simplify block creation) - #121019 (coverage: Simplify some parts of the coverage span refiner) - #121021 (Extend intra-doc link chapter in the rustdoc book) - #121031 (RustWrapper: adapt for coverage mapping API changes) Failed merges: - #121014 (Remove `force_print_diagnostic`) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-13Auto merge of #120055 - nikic:llvm-18, r=cuviperbors-4/+4
Update to LLVM 18 LLVM 18 final is planned to be released on Mar 5th. Rust 1.78 is planned to be released on May 2nd. Tested images: dist-x86_64-linux, dist-s390x-linux, dist-aarch64-linux, dist-riscv64-linux, dist-loongarch64-linux, dist-x86_64-freebsd, dist-x86_64-illumos, dist-x86_64-musl, x86_64-linux-integration, test-various, armhf-gnu, i686-msvc, x86_64-msvc, i686-mingw, x86_64-mingw, x86_64-apple-1, x86_64-apple-2, dist-aarch64-apple r? `@ghost`
2024-02-13RustWrapper: adapt for coverage mapping API changesTim Neumann-1/+1
2024-02-13Use MCSubtargetInfo::getAllProcessorFeatures()Nikita Popov-4/+4
This method is now available in upstream LLVM \o/
2024-02-13Rollup merge of #120995 - durin42:llvm-19-pgo-coldfuncopt, r=cuviperMatthias Krüger-0/+15
PassWrapper: adapt for llvm/llvm-project@93cdd1b5cfa3735c Should be no functional change. `@rustbot` label: +llvm-main
2024-02-12PassWrapper: adapt for ↵Augie Fackler-0/+15
llvm/llvm-project@93cdd1b5cfa3735c599949b77e24dbfbe570441a Should be no functional change. @rustbot label: +llvm-main
2024-02-12llvm-wrapper: adapt for LLVM API change: Add support for EXPORTAS name typesHans Wennborg-0/+3
Adapt for llvm/llvm-project@8f23464.
2024-02-06Rollup merge of #120502 - clubby789:remove-ffi-returns-twice, r=compiler-errorsMatthias Krüger-3/+0
Remove `ffi_returns_twice` feature The [tracking issue](https://github.com/rust-lang/rust/issues/58314) and [RFC](https://github.com/rust-lang/rfcs/pull/2633) have been closed for a couple of years. There is also an attribute gate in R-A which should be removed if this lands.
2024-02-06reviewklensy-6/+2
2024-02-06llvm-wrapper: remove llvm 12 hackklensy-6/+1
effectively reverts https://github.com/rust-lang/rust/commit/9a8acea78355b604dbeb29bc38bd4dbf7bfce95f
2024-01-30Remove `ffi_returns_twice` featureclubby789-3/+0
2024-01-12Revert "Auto merge of #113923 - DianQK:restore-no-builtins-lto, r=pnkfelix"DianQK-2/+7
This reverts commit 8c2b57721728233e074db69d93517614de338055, reversing changes made to 9cf18e98f82d85fa41141391d54485b8747da46f.
2024-01-05Pass LLVM error message back to pass wrapper.Ao Li-1/+3
2023-12-18Rollup merge of #118941 - krasimirgg:llvm-cov, r=nikicMatthias Krüger-0/+3
llvm-wrapper: adapt for LLVM API changes Adapt for https://github.com/llvm/llvm-project/commit/8ecbb0404d740d1ab173554e47cef39cd5e3ef8c. r? `@nikic` `@rustbot` label: +llvm-main
2023-12-18llvm-wrapper: adapt for LLVM API changesKrasimir Georgiev-0/+3
Adapt for https://github.com/llvm/llvm-project/commit/8ecbb0404d740d1ab173554e47cef39cd5e3ef8c.
2023-12-16Auto merge of #110494 - majaha:noTrapAfterNoreturn, r=nikicbors-0/+8
Use the LLVM option NoTrapAfterNoreturn Use this LLVM option: https://llvm.org/doxygen/classllvm_1_1TargetOptions.html#acd83fce25de1ac9f6c975135a8235c22 when TrapUnreachable is enabled. This prevents codegenning unnecessary double-traps in some situations. See further discussion here: https://github.com/rust-lang/compiler-team/issues/618
2023-12-12llvm-wrapper: adapt for LLVM API changeKrasimir Georgiev-1/+3
LLVM commit https://github.com/llvm/llvm-project/commit/f09cf34d00625e57dea5317a3ac0412c07292148 moved some functions to a different header: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/24416#018c5de6-b9c9-4b22-9473-6070d99dcfa7/233-537
2023-12-11Auto merge of #117962 - weihanglo:debug-name-table, r=wesleywiserbors-2/+23
fix: stop emitting `.debug_pubnames` and `.debug_pubtypes` A continuation of #94181. Fixes #48762 MCP can be found in <https://github.com/rust-lang/compiler-team/issues/688>. `.debug_pubnames` and `.debug_pubtypes` are poorly designed and people seldom use them. However, they take a considerable portion of size in the final binary. This tells LLVM stop emitting those sections on DWARFv4 or lower. DWARFv5 use `.debug_names` which is more concise in size and performant for name lookup. Some other no-really-useful personal notes: <details><summary>Details</summary> <p> ## Pepole saying they are not useful * https://github.com/rust-lang/rust/issues/48762 * https://rust-lang.zulipchat.com/#narrow/stream/317568-t-compiler.2Fwg-debugging/topic/investigating.20debuginfo.20size/near/342713604 * `DwarfCompileUnit::hasDwarfPubSections()` — https://github.com/llvm/llvm-project/blob/f633f325a1b808d33ca9653ed373353549ddcde6/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp#L1477-L1494 * clang default to no debug name table when no option provided — https://github.com/llvm/llvm-project/blob/f633f325a1b808d33ca9653ed373353549ddcde6/clang/lib/Frontend/CompilerInvocation.cpp#L1819-L1824 * GCC explicitly says GDB doesn't use pub sections (`TARGET_WANT_DEBUG_PUB_SECTIONS` only be true on Darwin) — https://github.com/gcc-mirror/gcc/blob/5d2a360f0a541646abb11efdbabc33c6a04de7ee/gcc/target.def#L6985-L6990 and https://github.com/bminor/binutils-gdb/blob/319b460545dc79280e2904dcc280057cf71fb753/gold/dwarf_reader.h#L424-L427 * Probably the only place that makes use of pub section in lldb — https://github.com/llvm/llvm-project/blob/725115d7bba2faf3d0c21442f4661dea77b8a77c/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L2117-L2135 * "The -gsplit-dwarf option requires -ggnu-pubnames." — https://github.com/gcc-mirror/gcc/blob/5d2a360f0a541646abb11efdbabc33c6a04de7ee/gcc/opts.cc#L1205 * LLVM: Always emit `.debug_names` with dwarf 5 for Apple platforms — https://reviews.llvm.org/D118754 </p> </details>
2023-12-11fix: stop emitting `.debug_pubnames` and `.debug_pubtypes`Weihang Lo-2/+23
`.debug_pubnames` and `.debug_pubtypes` are poorly designed and people seldom use them. However, they take a considerable portion of size in the final binary. This tells LLVM stop emitting those sections on DWARFv4 or lower. DWARFv5 use `.debug_names` which is more concise in size and performant for name lookup.
2023-12-11llvm-wrapper: adapt for LLVM API changeKrasimir Georgiev-0/+4
LLVM commit https://github.com/llvm/llvm-project/commit/1d608fc755a3e15d0020f61c9535c9b730ab9dec renamed the pass.
2023-12-09Auto merge of #117873 - quininer:android-emutls, r=Amanieubors-7/+3
Add emulated TLS support This is a reopen of https://github.com/rust-lang/rust/pull/96317 . many android devices still only use 128 pthread keys, so using emutls can be helpful. Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls. r? `@Amanieu`
2023-12-06Rollup merge of #118177 - sivadeilra:suppress-llvm-warnings, r=cuviperMatthias Krüger-0/+17
Suppress warnings in LLVM wrapper when targeting MSVC The LLVM header files generate many warnings when compiled using MSVC. This makes it difficult to work on the LLVM wrapper code, because the warnings and errors that are relevant to local edits are obscured by the hundreds of lines of warnings from the LLVM Headers.
2023-12-07Add emulated TLS supportquininer-7/+3
Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.
2023-12-01Auto merge of #113923 - DianQK:restore-no-builtins-lto, r=pnkfelixbors-7/+2
Restore `#![no_builtins]` crates participation in LTO. After #113716, we can make `#![no_builtins]` crates participate in LTO again. `#![no_builtins]` with LTO does not result in undefined references to the error. I believe this type of issue won't happen again. Fixes #72140. Fixes #112245. Fixes #110606. Fixes #105734. Fixes #96486. Fixes #108853. Fixes #108893. Fixes #78744. Fixes #91158. Fixes https://github.com/rust-lang/cargo/issues/10118. Fixes https://github.com/rust-lang/compiler-builtins/issues/347. The `nightly-2023-07-20` version does not always reproduce problems due to changes in compiler-builtins, core, and user code. That's why this issue recurs and disappears. Some issues were not tested due to the difficulty of reproducing them. r? pnkfelix cc `@bjorn3` `@japaric` `@alexcrichton` `@Amanieu`
2023-11-30Add `-Zfunction-return={keep,thunk-extern}` optionMiguel Ojeda-0/+3
This is intended to be used for Linux kernel RETHUNK builds. With this commit (optionally backported to Rust 1.73.0), plus a patched Linux kernel to pass the flag, I get a RETHUNK build with Rust enabled that is `objtool`-warning-free and is able to boot in QEMU and load a sample Rust kernel module. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-11-27Auto merge of #117947 - Dirbaio:drop-llvm-15, r=cuviperbors-81/+1
Update the minimum external LLVM to 16. With this change, we'll have stable support for LLVM 16 and 17. For reference, the previous increase to LLVM 15 was #114148 [Relevant zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/riscv.20forced-atomics)
2023-11-23remove unused pub fnklensy-26/+0
2023-11-22fix long linesArlie Davis-2/+2
2023-11-22suppress warnings on msvcArlie Davis-0/+17
2023-11-21Update the minimum external LLVM to 16.Dario Nieuwenhuis-81/+1
2023-11-21Tighten up linkage settings for LLVM bindingsBen Kimock-3/+3
2023-11-16Auto merge of #117948 - aeubanks:dibuilder, r=durin42bors-0/+3
llvm-wrapper: Pass newly added param to DIBuilder::createStaticMemberType() This was added in https://github.com/llvm/llvm-project/pull/72234. DW_TAG_member was the implicit default before. The LLVM change is quite sinister since due to weakly typed ints and default params, this was still successfully compiling against LLVM but was passing the wrong parameters.
2023-11-15llvm-wrapper: Pass newly added param to DIBuilder::createEnumerationType()Arthur Eubanks-1/+5
Added in LLVM in https://github.com/llvm/llvm-project/pull/72011.
2023-11-1517 -> 18Arthur Eubanks-1/+1