-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Niched option check not optimized out #144329
Copy link
Copy link
Open
Labels
C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcP-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcP-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
I tried this code (godbolt):
I expected to see this happen: only 1 check (len < 1)
Instead, this happened: length check and null check (from
let-elseonOption<&mut T>), the latter of which is always falseThe
#[inline(always)]is not necessary, but without it a weirder construct is generated:Version it worked on
It most recently worked on: 1.84
Version with regression
rustc --version --verbose:Regression in nightly-2024-12-16
get_commits_between returning commits, len: 9
commit[0] 2024-12-14: Auto merge of #134305 - matthiaskrgr:rollup-bja3lsz, r=matthiaskrgr
commit[1] 2024-12-14: Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung
commit[2] 2024-12-15: Auto merge of #134318 - matthiaskrgr:rollup-jda0jkx, r=matthiaskrgr
commit[3] 2024-12-15: Auto merge of #134258 - bjorn3:no_public_specialization, r=petrochenkov
commit[4] 2024-12-15: Auto merge of #133223 - zachs18:uniquerc-impls, r=Noratrieb
commit[5] 2024-12-15: Auto merge of #134332 - Zalathar:rollup-oe23hkw, r=Zalathar
commit[6] 2024-12-15: Auto merge of #134117 - DianQK:gep-i8, r=oli-obk
commit[7] 2024-12-15: Auto merge of #133417 - RalfJung:aarch64-float-abi, r=workingjubilee
commit[8] 2024-12-15: Auto merge of #134349 - jieyouxu:rollup-zqn0jox, r=jieyouxu
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged