-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add LLVM15-specific codegen test for try
/?
s that now optimize away
#100693
Conversation
These still generated a bunch of code back in Rust 1.63 (<https://rust.godbolt.org/z/z31P8h6rz>), but with LLVM 15 merged they no longer do 🎉
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors rollup=iffy (codegen test that doesn't run in the PR build, because that uses LLVM 13 but the test needs LLVM 15) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also include a test with Ok(x?)
? I think that this pattern is also quite common.
Because MIR inlining is on now, that's very much the same as the rust/library/core/src/result.rs Lines 2111 to 2114 in 9c20b2a
Basically what I picked here is the direct one -- the obvious match -- and the indirect one -- that to NOP has to see through all the trait calls -- so if the most-indirect one is fine, I'm not sure it's worth also listing the spots in the middle. |
@bors r+ rollup=iffy |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#99415 (Initial implementation of REUSE) - rust-lang#99544 (Expose `Utf8Lossy` as `Utf8Chunks`) - rust-lang#100585 (Fix trailing space showing up in example) - rust-lang#100596 (Remove unnecessary stderr files) - rust-lang#100642 (Update fortanix-sgx-abi and export some useful SGX usercall traits) - rust-lang#100691 (Make `same_type_modulo_infer` a proper `TypeRelation`) - rust-lang#100693 (Add LLVM15-specific codegen test for `try`/`?`s that now optimize away) - rust-lang#100710 (Windows: Load synch functions together) - rust-lang#100807 (Add TaKO8Ki to translation-related mention groups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…r=m-ou-se Inline `<T as From<T>>::from` I noticed (in rust-lang#100693 (comment)) that the MIR for <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=67097e0494363ee27421a4e3bdfaf513> has inlined most stuff ``` scope 5 (inlined <Result<i32, u32> as Try>::branch) ``` ``` scope 8 (inlined <Result<i32, u32> as Try>::from_output) ``` But yet the do-nothing `from` call was still there: ``` _17 = <u32 as From<u32>>::from(move _18) -> bb9; ``` So let's give this a try and see what perf has to say.
Inline `<T as From<T>>::from` I noticed (in rust-lang/rust#100693 (comment)) that the MIR for <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=67097e0494363ee27421a4e3bdfaf513> has inlined most stuff ``` scope 5 (inlined <Result<i32, u32> as Try>::branch) ``` ``` scope 8 (inlined <Result<i32, u32> as Try>::from_output) ``` But yet the do-nothing `from` call was still there: ``` _17 = <u32 as From<u32>>::from(move _18) -> bb9; ``` So let's give this a try and see what perf has to say.
Inline `<T as From<T>>::from` I noticed (in rust-lang/rust#100693 (comment)) that the MIR for <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=67097e0494363ee27421a4e3bdfaf513> has inlined most stuff ``` scope 5 (inlined <Result<i32, u32> as Try>::branch) ``` ``` scope 8 (inlined <Result<i32, u32> as Try>::from_output) ``` But yet the do-nothing `from` call was still there: ``` _17 = <u32 as From<u32>>::from(move _18) -> bb9; ``` So let's give this a try and see what perf has to say.
Inline `<T as From<T>>::from` I noticed (in rust-lang/rust#100693 (comment)) that the MIR for <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=67097e0494363ee27421a4e3bdfaf513> has inlined most stuff ``` scope 5 (inlined <Result<i32, u32> as Try>::branch) ``` ``` scope 8 (inlined <Result<i32, u32> as Try>::from_output) ``` But yet the do-nothing `from` call was still there: ``` _17 = <u32 as From<u32>>::from(move _18) -> bb9; ``` So let's give this a try and see what perf has to say.
These still generated a bunch of code back in Rust 1.63 (https://rust.godbolt.org/z/z31P8h6rz), but with LLVM 15 merged they no longer do 🎉