Slice bounds check not elided in trivial case when using a local varaible outside of a branch #134466
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
Which produces the following assembly on x86_64:
The branch with the call to
slice_start_index_len_fail
should be unreachable.Indeed, I can remove it by moving the slice operation inside the
if
statement:Which gives:
Which is what I expected.
The text was updated successfully, but these errors were encountered: