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

Codegen/allocator regression from 1.60 #97217

Closed
jgouly opened this issue May 20, 2022 · 6 comments · Fixed by #102099
Closed

Codegen/allocator regression from 1.60 #97217

jgouly opened this issue May 20, 2022 · 6 comments · Fixed by #102099
Labels
A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jgouly
Copy link

jgouly commented May 20, 2022

In 1.60 the following code causes no allocations:

pub fn main() -> i32 {
    let v1 = vec![5, 6, 7];
    let v1_iter = v1.iter();
    let total: i32 = v1_iter.sum();
    println!("{}",total);
    total
}

However in nightly there is an allocation, see: https://godbolt.org/z/cq9b1Pnva

EDIT:

Appears there is also a problem with 1.60 and opt-level 2 vs 3: https://godbolt.org/z/8MWjEvPbh

@jgouly jgouly added the C-bug Category: This is a bug. label May 20, 2022
@nox

This comment was marked as outdated.

@nox
Copy link
Contributor

nox commented May 20, 2022

@lqd suspects it's related to #94402. I checked 2022-03-01 and there is no alloc, while on 2022-03-02 the alloc comes back.

@nox
Copy link
Contributor

nox commented May 20, 2022

The allocation also goes away with opt-level 3 if you pass -C panic=abort

@workingjubilee workingjubilee added A-codegen Area: Code generation regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Jul 6, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 6, 2022
@apiraino
Copy link
Contributor

apiraino commented Jul 6, 2022

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 6, 2022
@pnkfelix
Copy link
Member

T-compiler P-high review, adding T-compiler label.

@rustbot label +T-compiler +A-LLVM

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 30, 2022
@pnkfelix
Copy link
Member

T-compiler P-high review, downgrading to P-medium.

@rustbot label: -P-high +P-medium

@rustbot rustbot added P-medium Medium priority and removed P-high High priority labels Sep 30, 2022
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 17, 2023
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Jun 27, 2023
…=nikic

Rebased: Mark drop calls in landing pads cold instead of noinline

I noticed that certain inlining optimizations were missing while staring at some compiled code output. I'd like to see this relanded, so I rebased the PR from ``@erikdesjardins`` (PR rust-lang#94823).

This PR reapplies rust-lang#92419, which was reverted in rust-lang#94402 due to rust-lang#94390.

Fixes rust-lang#46515, fixes rust-lang#87055.

Update: fixes rust-lang#97217.
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 2, 2023
…ikic

Rebased: Mark drop calls in landing pads cold instead of noinline

I noticed that certain inlining optimizations were missing while staring at some compiled code output. I'd like to see this relanded, so I rebased the PR from `@erikdesjardins` (PR rust-lang#94823).

This PR reapplies rust-lang#92419, which was reverted in rust-lang#94402 due to rust-lang#94390.

Fixes rust-lang#46515, fixes rust-lang#87055.

Update: fixes rust-lang#97217.
@bors bors closed this as completed in 2e5a9dd Oct 2, 2023
antoyo pushed a commit to antoyo/rust that referenced this issue Oct 9, 2023
…ikic

Rebased: Mark drop calls in landing pads cold instead of noinline

I noticed that certain inlining optimizations were missing while staring at some compiled code output. I'd like to see this relanded, so I rebased the PR from `@erikdesjardins` (PR rust-lang#94823).

This PR reapplies rust-lang#92419, which was reverted in rust-lang#94402 due to rust-lang#94390.

Fixes rust-lang#46515, fixes rust-lang#87055.

Update: fixes rust-lang#97217.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants