[MIR-opt] matches!(x, Some(_))
should simplify to Eq(Discriminant, Const)
#131219
Labels
A-mir-opt
Area: MIR optimizations
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Repro: https://rust.godbolt.org/z/4dvWdqcn5
Today, this check
simplifies as expected down to just
Checking for
Some
in anOption
, however,doesn't and ends up taking a whole five basic blocks
That's wasteful, and shouldn't happen.
The text was updated successfully, but these errors were encountered: