about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back
AgeCommit message (Collapse)AuthorLines
2018-08-01Make sure we prepare for thin LTO whenever we are emitting bitcodeColin Pronovost-0/+31
Emitting LLVM bitcode uses ThinLTOBuffers, so we need to prepare for thin LTO or we will likely cause errors in LLVM.
2018-07-31rustc: Handle linker diagnostic from LLVMAlex Crichton-8/+17
Previously linker diagnostic were being hidden when two modules were linked together but failed to link. This commit fixes the situation by ensuring that we have a diagnostic handler installed and also adds support for handling linker diagnostics.
2018-07-30Disable debug sections when optimization flags is set for LLD.Yury Delendik-0/+12
2018-07-30rustc_codegen_llvm: fix tidy errors.Irina Popa-1/+4
2018-07-30rustc_codegen_llvm: use safe references for ThinLTOData.Irina Popa-7/+6
2018-07-30rustc_codegen_llvm: use safe references for ThinLTOBuffer.Irina Popa-2/+2
2018-07-30rustc_codegen_llvm: use safe references for ModuleBuffer.Irina Popa-2/+2
2018-07-30rustc_codegen_llvm: use safe references for RustArchiveMember.Irina Popa-10/+10
2018-07-30rustc_codegen_llvm: use safe references for ArchiveChild.Irina Popa-3/+3
2018-07-30rustc_codegen_llvm: use safe references for Linker.Irina Popa-5/+5
2018-07-30rustc_codegen_llvm: use safe references for PassManager.Irina Popa-46/+48
2018-07-30rustc_codegen_llvm: use safe references for Twine, DiagnosticInfo, SMDiagnostic.Irina Popa-5/+3
2018-07-30rustc_codegen_llvm: use safe references for TargetMachine.Irina Popa-5/+5
2018-07-30rustc_codegen_llvm: use safe references for Pass.Irina Popa-8/+6
2018-07-30rustc_codegen_llvm: use safe references for PassManagerBuilder.Irina Popa-1/+1
2018-07-30rustc_codegen_llvm: use safe references for Type.Irina Popa-3/+3
2018-07-30rustc_codegen_llvm: use safe references for Context and Module.Irina Popa-340/+343
2018-07-30rustc_codegen_llvm: move from empty enums to extern types.Irina Popa-4/+4
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-17/+17
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-3/+1
Replace push loops with extend() where possible Or set the vector capacity where I couldn't do it. According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop: 10 elements (6.1 times faster): ``` test bench_extension ... bench: 75 ns/iter (+/- 23) test bench_push_loop ... bench: 458 ns/iter (+/- 142) ``` 100 elements (11.12 times faster): ``` test bench_extension ... bench: 87 ns/iter (+/- 26) test bench_push_loop ... bench: 968 ns/iter (+/- 3,528) ``` 1000 elements (11.04 times faster): ``` test bench_extension ... bench: 311 ns/iter (+/- 9) test bench_push_loop ... bench: 3,436 ns/iter (+/- 233) ``` Seems like a good idea to use `extend` as much as possible.
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-3/+1
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-2/+2
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-29Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakisbors-3/+2
Misc cleanups
2018-07-28Don't format!() string literalsljedrz-17/+17
2018-07-28Rollup merge of #52703 - ljedrz:vec_improvements, r=nikomatsakiskennytm-2/+3
Improve a few vectors - calculate capacity or build from iterators Collecting from iterators improves readability and tailoring vector capacities should be beneficial in terms of performance.
2018-07-27Unnecessary `to_string`Shotaro Yamada-3/+2
2018-07-27Prefer to_string() to format!()ljedrz-2/+2
2018-07-26Improve a few vectors - calculate capacity or build from iteratorsljedrz-2/+3
2018-07-26Rollup merge of #52654 - alecmocatta:master, r=alexcrichtonMark Rousskov-17/+19
Format linker args in a way that works for gcc and ld Pass multiple linker arguments rather than concatenate with commas (fixes #52634). `-l library` -> `-llibrary` to work with apple's ld. To build with apple's ld I'm currently also passing `-C link-args="-arch x86_64 -macosx_version_min 10.13.0"`. I'll try and understand the latter flag better before PRing that. This PR currently works for me. Hopefully CI will pick up any grievous ramifications in other toolchains? Thanks to @alexcrichton for the pointer to the relevant code!
2018-07-24break --subsystem=x into 2 args; closer to former presumably known-good ↵alecmocatta-1/+2
incantation
2018-07-24Pass multiple linker arguments rather than concatenate with commas; -l ↵alecmocatta-17/+18
library -> -llibrary to work with apple's ld
2018-07-23Replace a few expect+format combos with unwrap_or_else+panicljedrz-2/+2
2018-07-21Rollup merge of #52505 - alexcrichton:remove-thinlto-hack, r=nikomatsakiskennytm-14/+0
rustc: Remove a workaround in ThinLTO fixed upstream This commit removes a hack in our ThinLTO passes which removes available externally functions manually. The [upstream bug][1] has long since been fixed, so we should be able to rely on LLVM natively for this now! [1]: https://bugs.llvm.org/show_bug.cgi?id=35736
2018-07-18rustc: Remove a workaroudn in ThinLTO fixed upstreamAlex Crichton-14/+0
This commit removes a hack in our ThinLTO passes which removes available externally functions manually. The [upstream bug][1] has long since been fixed, so we should be able to rely on LLVM natively for this now! [1]: https://bugs.llvm.org/show_bug.cgi?id=35736
2018-07-18rustc: Stabilize #[wasm_import_module] as #[link(...)]Alex Crichton-26/+39
This commit stabilizes the `#[wasm_import_module]` attribute as `#[link(wasm_import_module = "...")]`. Tracked by #52090 this new directive in the `#[link]` attribute is used to configured the module name that the imports are listed with. The WebAssembly specification indicates two utf-8 names are associated with all imported items, one for the module the item comes from and one for the item itself. The item itself is configurable in Rust via its identifier or `#[link_name = "..."]`, but the module name was previously not configurable and defaulted to `"env"`. This commit ensures that this is also configurable. Closes #52090
2018-07-16ItemKindcsmoe-2/+2
2018-07-16Revert "Provide a way of accessing the ThinLTO module import map in rustc."Michael Woerister-68/+1
This reverts commit 9df56ca0eea1a8f5af945df25ce23e276b1d48a7.
2018-07-16Revert "Persist ThinLTO import data in incr. comp. session directory."Michael Woerister-81/+2
This reverts commit 8dc7ddb9763f28b83de7bf3b3025f8042ea9e830.
2018-07-16Revert "Clean up LLVM module naming (just use CodegenUnit names)."Michael Woerister-6/+15
This reverts commit f6894ebe664d111259a91a2b5fcc1236ca413436.
2018-07-16Revert "Use callback-based interface to load ThinLTO import data into rustc."Michael Woerister-31/+43
This reverts commit e045a6cd8c0235a26ef11e6cd9a13ebd817f1265.
2018-07-15Auto merge of #52381 - oli-obk:ty_to_def_id, r=eddybbors-11/+9
Remove `ty_to_def_id` fixes https://github.com/rust-lang/rust/issues/52341 The uses were mostly convenience and generally "too powerful" (would also have worked for types that weren't interesting at the use site) r? @eddyb
2018-07-15Ubsan this newly discovered dead codeOliver Schneider-14/+9
2018-07-14Expose a self-referential objectOliver Schneider-0/+3
2018-07-13Auto merge of #52266 - michaelwoerister:incr-thinlto-preliminaries, ↵bors-18/+143
r=alexcrichton Preliminary work for incremental ThinLTO. Since implementing incremental ThinLTO is a bit more involved than I initially thought, I'm splitting out some of the things that already work. This PR (1) adds a way accessing some ThinLTO information in `rustc` and (2) does some cleanup around CGU/object file naming (which makes things quite a bit nicer). This is probably best reviewed one commit at a time.
2018-07-13Use callback-based interface to load ThinLTO import data into rustc.Michael Woerister-43/+31
2018-07-11Clean up LLVM module naming (just use CodegenUnit names).Michael Woerister-15/+6
2018-07-11Rollup merge of #52252 - ljedrz:dyn_librustc_codegen_llvm, r=varkorMark Rousskov-24/+24
Deny bare trait objects in in src/librustc_codegen_llvm Enforce `#![deny(bare_trait_objects)]` in `src/librustc_codegen_llvm`.
2018-07-11Persist ThinLTO import data in incr. comp. session directory.Michael Woerister-2/+81
2018-07-11Provide a way of accessing the ThinLTO module import map in rustc.Michael Woerister-1/+68
2018-07-11Auto merge of #51230 - nikic:no-verify-lto, r=pnkfelixbors-10/+15
Disable LLVM verification by default Currently -Z no-verify only controls IR verification prior to LLVM codegen, while verification is performed unconditionally both before and after linking with (Thin)LTO. Also wondering what the sentiment is on disabling verification by default (and e.g. only enabling it on ALT builds with assertions). This does not seem terribly useful outside of rustc development and it does seem to show up in profiles (at something like 3%). **EDIT:** A table showing the various configurations and what is enabled when. | Configuration | Dynamic verification performed | LLVM static assertions compiled in | | --- | --- | --- | | alt builds | | yes | | nightly builds | | no | | stable builds | | no | | CI builds | | | | dev builds in a checkout | | |