Skip to content
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

Rollup of 4 pull requests #113821

Closed
wants to merge 10 commits into from

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

dianqk and others added 10 commits July 16, 2023 19:46
…plied at the crate level.

When `no_builtins` is applied at the crate level, we should add the
`no-builtins` attribute to each function to ensure it takes effect in LTO.
…, r=pnkfelix

Add the `no-builtins` attribute to functions when `no_builtins` is applied at the crate level.

**When `no_builtins` is applied at the crate level, we should add the `no-builtins` attribute to each function to ensure it takes effect in LTO.**

This is also the reason why no_builtins does not take effect in LTO as mentioned in rust-lang#35540.

Now, `#![no_builtins]` should be similar to `-fno-builtin` in clang/gcc, see https://clang.godbolt.org/z/z4j6Wsod5.

Next, we should make `#![no_builtins]` participate in LTO again. That makes sense, as LTO also takes into consideration function-level instruction optimizations, such as the MachineOutliner. More importantly, when a user writes a large `#![no_builtins]` crate, they would like this crate to participate in LTO as well.

We should also add a function-level no_builtins attribute to allow users to have more control over it. This is similar to Clang's `__attribute__((no_builtin))` feature, see https://clang.godbolt.org/z/Wod6KK6eq. Before implementing this feature, maybe we should discuss whether to support more fine-grained control, such as `__attribute__((no_builtin("memcpy")))`.

Related discussions:
- rust-lang#109821
- rust-lang#35540

Next (a separate pull request?):
- [ ] Revert rust-lang#35637
- [ ] Add a function-level `no_builtin` attribute?
…-105735-fix, r=notriddle,aDotInTheVoid

Fix invalid display of inlined re-export when both local and foreign items are inlined

Fixes rust-lang#105735.

The bug is actually quite interesting: at the `clean` pass, local inlined items have their `use` item removed, however foreign items don't have their `use` item removed because it's in the `clean` pass that we handle them. So when a `use` inlines both a local and a foreign item, it will work as expected for the foreign one, but not for the local as its `use` should not be around anymore.

To prevent this, I created a new `inlined_foreigns` field into the `Module` struct to allow to remove the `use` item early on for foreign items as well. Then we iterate it in the `clean` pass directly.

r? `@notriddle`
Properly document `lifetime_mapping` in `OpaqueTy`

Also use an `Option` to signify that the value is actually present, instead of just no captured lifetimes.
…-suggestion, r=oli-obk

Fix removal span calculation of `unused_qualifications` suggestion

Given a path such as `std::ops::Index<str>`, calculate the unnecessary qualification removal span by computing the beginning of the entire span until the ident span of the last path segment, which handles generic arguments and lifetime arguments in the last path segment. Previous logic only kept the ident span of the last path segment which is incorrect.

Closes rust-lang#113808.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jul 18, 2023
@GuillaumeGomez
Copy link
Member Author

@bors r+ p=4 rollup=never

@bors
Copy link
Collaborator

bors commented Jul 18, 2023

📌 Commit a215ee4 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2023
@bors
Copy link
Collaborator

bors commented Jul 18, 2023

⌛ Testing commit a215ee4 with merge 824b47922254fa197735929fa13f48bb2a623e64...

@rust-log-analyzer
Copy link
Collaborator

The job test-various failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [codegen] tests/codegen/no_builtins-at-crate.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/no_builtins-at-crate/no_builtins-at-crate.ll" "/checkout/tests/codegen/no_builtins-at-crate.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC" "--dump-input-context" "100"
stdout: none
/checkout/tests/codegen/no_builtins-at-crate.rs:6:11: error: CHECK: expected string not found in input
/checkout/tests/codegen/no_builtins-at-crate.rs:6:11: error: CHECK: expected string not found in input
// CHECK: define void @__aeabi_memcpy
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/no_builtins-at-crate/no_builtins-at-crate.ll:1:1: note: scanning from here
; ModuleID = 'no_builtins_at_crate.9eaad54fbc12e3b9-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/no_builtins-at-crate/no_builtins-at-crate.ll:7:11: note: possible intended match here
define dso_local void @__aeabi_memcpy(ptr noundef %dest, ptr noundef %src, i32 noundef %size) unnamed_addr #0 {

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/no_builtins-at-crate/no_builtins-at-crate.ll
Check file: /checkout/tests/codegen/no_builtins-at-crate.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
           1: ; ModuleID = 'no_builtins_at_crate.9eaad54fbc12e3b9-cgu.0' 
check:6'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
           2: source_filename = "no_builtins_at_crate.9eaad54fbc12e3b9-cgu.0" 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           3: target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20" 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           4: target triple = "wasm32-unknown-unknown" 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           5:  
check:6'0     ~
           6: ; Function Attrs: nounwind 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           7: define dso_local void @__aeabi_memcpy(ptr noundef %dest, ptr noundef %src, i32 noundef %size) unnamed_addr #0 { 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:6'1               ?                                                                                                      possible intended match
           8: start: 
check:6'0     ~~~~~~~
           9:  %_4 = tail call noundef ptr @memcpy(ptr noundef %dest, ptr noundef %src, i32 noundef %size) #1 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          10:  ret void 
check:6'0     ~~~~~~~~~~
          11: } 
check:6'0     ~~
          12:  
check:6'0     ~
          13: ; Function Attrs: nounwind 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
          14: declare dso_local noundef ptr @memcpy(ptr noundef, ptr noundef, i32 noundef) unnamed_addr #0 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          15:  
check:6'0     ~
          16: attributes #0 = { nounwind "no-builtins" "target-cpu"="generic" } 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          17: attributes #1 = { nounwind } 
check:6'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------------------



@bors
Copy link
Collaborator

bors commented Jul 18, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 18, 2023
@GuillaumeGomez GuillaumeGomez deleted the rollup-vs7g2it branch July 18, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants