New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unconditionally emit the target-cpu LLVM attribute. #56609

Merged
merged 1 commit into from Dec 14, 2018

Conversation

Projects
None yet
6 participants
@michaelwoerister
Copy link
Contributor

michaelwoerister commented Dec 7, 2018

This PR makes rustc always emit the target-cpu LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in libstd. So far libstd functions were the only function without a target-cpu attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Dec 7, 2018

@bors try

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 7, 2018

⌛️ Trying commit 86822eb with merge 85f3e04...

bors added a commit that referenced this pull request Dec 7, 2018

Auto merge of #56609 - michaelwoerister:unconditional-target-cpu-attr…
…, r=<try>

Unconditionally emit the target-cpu LLVM attribute.

This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Dec 7, 2018

r=me assuming perf looks reasonable

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 7, 2018

☀️ Test successful - status-travis
State: approved= try=True

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Dec 7, 2018

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 7, 2018

Success: Queued 85f3e04 with parent 1c3236a, comparison URL.

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Dec 7, 2018

So far libstd functions were the only function without a target-cpu attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

That does not appear to be true at all? That is, I don’t recall seeing this attribute in code generated by rustc, ever.


There is one use case of mine that is semi-broken by unconditionally emitting target-cpu attribute. When investigating codegen bugs for trivial code, I like emiting LLVM-IR and running it through llc with varying -mtriple values. Now, with target-cpu applied to every function, llc would emit:

'X' is not a recognized processor for this target (ignoring processor)

a dozen times for each function, making it necessary to remove those attributes somehow to make it workable. Not that I’m gonna block this PR on it, it is just something I felt was not taken into account of being possible :)

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Dec 7, 2018

So far libstd functions were the only function without a target-cpu attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

That does not appear to be true at all? That is, I don’t recall seeing this attribute in code generated by rustc, ever.

What I meant was: When compiling all of your code with xLTO then only the libstd LLVM IR pulled in from crate metadata would not have the attribute.

I'm sorry about the regression you mention :(

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 7, 2018

Finished benchmarking try commit 85f3e04

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Dec 10, 2018

The performance difference looks like noise.

@bors r=alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 10, 2018

📌 Commit 86822eb has been approved by alexcrichton

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Dec 11, 2018

Rollup merge of rust-lang#56609 - michaelwoerister:unconditional-targ…
…et-cpu-attr, r=alexcrichton

Unconditionally emit the target-cpu LLVM attribute.

This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton

bors added a commit that referenced this pull request Dec 11, 2018

Auto merge of #56728 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 11, 2018

⌛️ Testing commit 86822eb with merge 91e470c...

bors added a commit that referenced this pull request Dec 11, 2018

Auto merge of #56609 - michaelwoerister:unconditional-target-cpu-attr…
…, r=alexcrichton

Unconditionally emit the target-cpu LLVM attribute.

This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 11, 2018

💔 Test failed - status-appveyor

bors added a commit that referenced this pull request Dec 11, 2018

Auto merge of #56728 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)

Failed merges:

r? @ghost
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Dec 12, 2018

@bors: retry

bors added a commit that referenced this pull request Dec 12, 2018

Auto merge of #56728 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56572 (Contexually dependent error message for E0424 when value is assigned to "self")
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56682 (Update the stdsimd submodule)
 - #56691 (fix install broken link)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Dec 12, 2018

Rollup merge of rust-lang#56609 - michaelwoerister:unconditional-targ…
…et-cpu-attr, r=alexcrichton

Unconditionally emit the target-cpu LLVM attribute.

This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton

kennytm added a commit to kennytm/rust that referenced this pull request Dec 13, 2018

Rollup merge of rust-lang#56609 - michaelwoerister:unconditional-targ…
…et-cpu-attr, r=alexcrichton

Unconditionally emit the target-cpu LLVM attribute.

This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton

bors added a commit that referenced this pull request Dec 13, 2018

Auto merge of #56775 - kennytm:rollup, r=kennytm
Rollup of 34 pull requests

Successful merges:

 - #56142 ([std] Osstr lossy example)
 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56351 (Stabilize `linker-flavor` flag.)
 - #56439 (Clearer error message for dead assign)
 - #56490 (Add checked_add method to Instant time type)
 - #56507 (polonius tweaks)
 - #56562 (Update libc version required by rustc)
 - #56600 (bootstrap: fix edition)
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56658 (Add non-panicking `maybe_new_parser_from_file` variant)
 - #56672 (Document time of back operations of a Linked List)
 - #56677 (#[must_use] on traits in stdlib)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56691 (fix install broken link)
 - #56695 (Fix irrefutable matches on integer ranges)
 - #56699 (Use a `newtype_index!` within `Symbol`.)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)
 - #56713 (Test capacity of ZST vector)
 - #56718 (Use libbacktrace pretty-printing)
 - #56725 (fix rust-lang/rust issue #50583)
 - #56731 (Add missing urls in ffi module docs)
 - #56738 (Fix private_no_mangle_fns message grammar)
 - #56742 (infer: remove Box from a returned Iterator)
 - #56746 (Add test of current behavior (infer free region within closure body))
 - #56747 (target: remove Box returned by get_targets)
 - #56749 (x86: Add the `adx` target feature to whitelist)
 - #56755 (Account for `impl Trait` when suggesting lifetime)
 - #56756 (Disable btree pretty-printers on older gdbs)
 - #56758 (Add short emoji status to toolstate updates)
 - #56783 (Add `--pinentry-mode=loopback` to deployment script)

bors added a commit that referenced this pull request Dec 13, 2018

Auto merge of #56775 - kennytm:rollup, r=kennytm
Rollup of 32 pull requests

Successful merges:

 - #56142 ([std] Osstr lossy example)
 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56351 (Stabilize `linker-flavor` flag.)
 - #56439 (Clearer error message for dead assign)
 - #56507 (polonius tweaks)
 - #56562 (Update libc version required by rustc)
 - #56600 (bootstrap: fix edition)
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56658 (Add non-panicking `maybe_new_parser_from_file` variant)
 - #56672 (Document time of back operations of a Linked List)
 - #56677 (#[must_use] on traits in stdlib)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56691 (fix install broken link)
 - #56695 (Fix irrefutable matches on integer ranges)
 - #56699 (Use a `newtype_index!` within `Symbol`.)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)
 - #56713 (Test capacity of ZST vector)
 - #56718 (Use libbacktrace pretty-printing)
 - #56725 (fix rust-lang/rust issue #50583)
 - #56731 (Add missing urls in ffi module docs)
 - #56738 (Fix private_no_mangle_fns message grammar)
 - #56742 (infer: remove Box from a returned Iterator)
 - #56746 (Add test of current behavior (infer free region within closure body))
 - #56747 (target: remove Box returned by get_targets)
 - #56749 (x86: Add the `adx` target feature to whitelist)
 - #56755 (Account for `impl Trait` when suggesting lifetime)
 - #56756 (Disable btree pretty-printers on older gdbs)
 - #56758 (Add short emoji status to toolstate updates)

kennytm added a commit to kennytm/rust that referenced this pull request Dec 14, 2018

Rollup merge of rust-lang#56609 - michaelwoerister:unconditional-targ…
…et-cpu-attr, r=alexcrichton

Unconditionally emit the target-cpu LLVM attribute.

This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton

bors added a commit that referenced this pull request Dec 14, 2018

Auto merge of #56803 - kennytm:rollup, r=kennytm
Rollup of 36 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56490 (Add checked_add method to Instant time type)
 - #56507 (polonius tweaks)
 - #56562 (Update libc version required by rustc)
 - #56600 (bootstrap: fix edition)
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56658 (Add non-panicking `maybe_new_parser_from_file` variant)
 - #56672 (Document time of back operations of a Linked List)
 - #56677 (#[must_use] on traits in stdlib)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56691 (fix install broken link)
 - #56695 (Fix irrefutable matches on integer ranges)
 - #56699 (Use a `newtype_index!` within `Symbol`.)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56709 (Remove unneeded extra chars to reduce search-index size)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)
 - #56713 (Test capacity of ZST vector)
 - #56718 (Use libbacktrace pretty-printing)
 - #56725 (fix rust-lang/rust issue #50583)
 - #56731 (Add missing urls in ffi module docs)
 - #56738 (Fix private_no_mangle_fns message grammar)
 - #56742 (infer: remove Box from a returned Iterator)
 - #56744 (specialize: remove Boxes used by Children::insert)
 - #56746 (Add test of current behavior (infer free region within closure body))
 - #56747 (target: remove Box returned by get_targets)
 - #56749 (x86: Add the `adx` target feature to whitelist)
 - #56751 (Allow ptr::hash to accept fat pointers)
 - #56755 (Account for `impl Trait` when suggesting lifetime)
 - #56756 (Disable btree pretty-printers on older gdbs)
 - #56758 (Add short emoji status to toolstate updates)
 - #56760 (Deduplicate unsatisfied trait bounds)
 - #56769 (Add x86_64-unknown-uefi target)
 - #56789 (rustc: Add an unstable `simd_select_bitmask` intrinsic)

bors added a commit that referenced this pull request Dec 14, 2018

Auto merge of #56803 - kennytm:rollup, r=kennytm
Rollup of 36 pull requests

Successful merges:

 - #56203 (Add lint for items deprecated in future)
 - #56343 (Remove not used mod)
 - #56439 (Clearer error message for dead assign)
 - #56490 (Add checked_add method to Instant time type)
 - #56507 (polonius tweaks)
 - #56562 (Update libc version required by rustc)
 - #56600 (bootstrap: fix edition)
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56658 (Add non-panicking `maybe_new_parser_from_file` variant)
 - #56672 (Document time of back operations of a Linked List)
 - #56677 (#[must_use] on traits in stdlib)
 - #56679 (overhaul external doc attribute diagnostics)
 - #56691 (fix install broken link)
 - #56695 (Fix irrefutable matches on integer ranges)
 - #56699 (Use a `newtype_index!` within `Symbol`.)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56709 (Remove unneeded extra chars to reduce search-index size)
 - #56710 (Always set the RDRAND and RDSEED features on SGX)
 - #56713 (Test capacity of ZST vector)
 - #56718 (Use libbacktrace pretty-printing)
 - #56725 (fix rust-lang/rust issue #50583)
 - #56731 (Add missing urls in ffi module docs)
 - #56738 (Fix private_no_mangle_fns message grammar)
 - #56742 (infer: remove Box from a returned Iterator)
 - #56744 (specialize: remove Boxes used by Children::insert)
 - #56746 (Add test of current behavior (infer free region within closure body))
 - #56747 (target: remove Box returned by get_targets)
 - #56749 (x86: Add the `adx` target feature to whitelist)
 - #56751 (Allow ptr::hash to accept fat pointers)
 - #56755 (Account for `impl Trait` when suggesting lifetime)
 - #56756 (Disable btree pretty-printers on older gdbs)
 - #56758 (Add short emoji status to toolstate updates)
 - #56760 (Deduplicate unsatisfied trait bounds)
 - #56769 (Add x86_64-unknown-uefi target)
 - #56789 (rustc: Add an unstable `simd_select_bitmask` intrinsic)

kennytm added a commit to kennytm/rust that referenced this pull request Dec 14, 2018

Rollup merge of rust-lang#56609 - michaelwoerister:unconditional-targ…
…et-cpu-attr, r=alexcrichton

Unconditionally emit the target-cpu LLVM attribute.

This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code.

r? @alexcrichton

bors added a commit that referenced this pull request Dec 14, 2018

Auto merge of #56818 - kennytm:rollup-2, r=kennytm
Rollup of 14 pull requests (first batch)

Successful merges:

 - #56562 (Update libc version required by rustc)
 - #56609 (Unconditionally emit the target-cpu LLVM attribute.)
 - #56637 (rustdoc: Fix local reexports of proc macros)
 - #56658 (Add non-panicking `maybe_new_parser_from_file` variant)
 - #56695 (Fix irrefutable matches on integer ranges)
 - #56699 (Use a `newtype_index!` within `Symbol`.)
 - #56702 ([self-profiler] Add column for percent of total time)
 - #56708 (Remove some unnecessary feature gates)
 - #56709 (Remove unneeded extra chars to reduce search-index size)
 - #56744 (specialize: remove Boxes used by Children::insert)
 - #56748 (Update panic message to be clearer about env-vars)
 - #56749 (x86: Add the `adx` target feature to whitelist)
 - #56756 (Disable btree pretty-printers on older gdbs)
 - #56789 (rustc: Add an unstable `simd_select_bitmask` intrinsic)

r? @ghost

@bors bors merged commit 86822eb into rust-lang:master Dec 14, 2018

1 of 2 checks passed

homu Test failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment