cmd/compile: loop induction with `*` and `<<` induction operators
Open
BugReport
compiler/runtime
NeedsInvestigation
Performance
- Dominant language
- Go
- Stars
- 139k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
```
go version go1.27-devel_a6500456f3 Wed Mar 25 22:41:27 2026 -0700 linux/amd64
```
See the following minimal repro:
```go
package p
func f(s []byte) {
for i := uint(1); i < uint(len(s)); i *= 2 {
_ = s[i]
}
}
```
This generate a bounds check even tho we don't need to.
Contributor guide
Research direction
Start by running the provided Go 1.27 development build with the minimal slice-indexing reproducer and inspect the generated code or bounds-check diagnostics. Trace the compiler's loop-induction handling for multiplication and left-shift operators; done means the unnecessary bounds check is eliminated for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100