Open
Description
With inline_const_pat
being removed in #138492, it might be nice to optimize codegen of pat if pat == const { .. }
.
Right now
match a {
1 => 42,
b if b == 7 => 100,
_ => 99,
}
Produces a SwitchInt
and then a separate equality check.
Changing the second pattern to 7 => 100
produces a single SwitchInt
.
I assume that the optimizer can recover this (at least for simpler cases), but it might be nice for the compiler to generate the simplified MIR directly (especially with inline_const_pat
gone).