rustc fails to detect variable bounds #100308
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
A-mir-opt
Area: MIR optimizations
C-bug
Category: This is a bug.
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.
This is probably an LLVM issue, but I decided to start my journey here. rustc/LLVM seems to be unable to detect bounds of a variable inside of this simple loop:
The code generated for the function above is not a simple constant return, but it actually processes the whole slice.
The reason why this is an interesting use case is because you cannot seem to write a fully optimized
compact
function without unsafe code:godbolt (with bounds check)
godbolt (without bounds check)
The text was updated successfully, but these errors were encountered: