Open
Description
#[no_mangle]
pub fn f() {
for _ in 0..=100 {
()
}
}
#[no_mangle]
pub fn g() {
for _ in 0..100 {
()
}
}
with -O gives
f:
xor ecx, ecx
mov eax, 100
.LBB0_1:
lea edx, [rcx + 1]
cmp ecx, 100
mov ecx, edx
cmovge ecx, eax
jge .LBB0_3
cmp ecx, 101
jl .LBB0_1
.LBB0_3:
ret
g:
ret
Meta
Exists in both 1.77 and nightly.
Backtrace
<backtrace>
@rustbot label +A-codegen +A-LLVM +C-optimization +I-slow +S-has-mcve +I-heavy +T-compiler -needs-triage
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generationCategory: This is a bug.Category: An issue highlighting optimization opportunities or PRs implementing suchIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to performance of generated code.Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Issue expected to be fixed by the next major LLVM upgrade, or backported fixes