I'm not sure, but I suspect that the prove pass does not propagate known 
ranges through divides.

On Tuesday, February 6, 2024 at 7:39:56 AM UTC-8 Leonard Mittmann wrote:

> I am trying to optimize the loop performance by reducing the number of 
> bound checks. Inside the loop I compute a slice index and access two slice 
> indexes like this:
>
> j := i / 2
> s[j+1] = i
> s[j] = i // <- I want to get rid of this bound check
>
> I assumed that I can get rid of the second bound check, as the compiler 
> could already know that j+1 < len(s) and j >= 0. Am I missing something? 
> Any suggestions how to solve this?
>
> The full boiled down code to reproduce my issue is here: 
> https://go.godbolt.org/z/hsjPh3WT7
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ab37e21f-0df2-49e5-a222-eb6dbb9cd12an%40googlegroups.com.

Reply via email to