Open
Description
In this example:
pub fn test() -> Vec<u32> {
let mut vec = Vec::with_capacity(3);
let mut i = 0;
while i < 3 {
vec.push(32);
i += 1;
}
vec
}
the compiler produces sub-optimal assembly.
https://rust.godbolt.org/z/1T3Knodn8
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generationCategory: An issue highlighting optimization opportunities or PRs implementing suchIssue: Problems and improvements with respect to performance of generated code.Relevant to the compiler team, which will review and decide on the PR/issue.