Missed optimization: loop with increasing index doesn't elide bounds check #74688
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
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 and many variations of it and I found out this doesn't elide the bounds check on
&buf[i..]
.Assembly Output
Manually checking that
i
is ok elides the bounds check and ends up being optimized away!?Assembly Output
This third example generates the same assembly as the second one, so I think it's really optimizing away the manual check on the second example?
Assembly Output
Possibly related: #74186
The text was updated successfully, but these errors were encountered: