The panic branch of Some(x).unwrap()
is not removed for some types
#93011
Labels
A-codegen
Area: Code generation
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-heavy
Issue: Problems and improvements with respect to binary size of generated code.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
Demos: https://godbolt.org/z/TMh3Krfc5
The motivating example is:
It looks to me like the problem with
Vec
is that specifically thenonnull
attribute does not survive being wrapped in two structs that each contain a second member. If either ofRawVec
orVec
is missing ausize
member, the optimization works.There is a missed
NonZero*
optimization in here that I found looking for types that fail to optimize. It's unclear to me if this was reported previously in #49572, or if whatever fixes the problem withVec
will also fix theNonZero*
example.I think this is similar but not the same problem as seen in #71257
The text was updated successfully, but these errors were encountered: