]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/liveness: use slices.Reverse
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 4 Sep 2024 16:57:41 +0000 (23:57 +0700)
committerGopher Robot <gobot@golang.org>
Wed, 4 Sep 2024 20:28:38 +0000 (20:28 +0000)
Now that we're bootstrapping from a toolchain that has the slices
package.

Updates #64751

Change-Id: Id50d76de05e353ef06d64b47ad6400b2b7572205
Reviewed-on: https://go-review.googlesource.com/c/go/+/610775
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/liveness/intervals.go

index feca35b306d37ecee9f79b470b1f65b69a1a57ed..04b1ea50bad135ad3c17f02a484f4cbf7d51e0c6 100644 (file)
@@ -49,6 +49,7 @@ package liveness
 import (
        "fmt"
        "os"
+       "slices"
        "strings"
 )
 
@@ -131,11 +132,7 @@ func (c *IntervalsBuilder) setLast(x int) {
 
 func (c *IntervalsBuilder) Finish() (Intervals, error) {
        // Reverse intervals list and check.
-       // FIXME: replace with slices.Reverse once the
-       // bootstrap version supports it.
-       for i, j := 0, len(c.s)-1; i < j; i, j = i+1, j-1 {
-               c.s[i], c.s[j] = c.s[j], c.s[i]
-       }
+       slices.Reverse(c.s)
        if err := check(c.s); err != nil {
                return Intervals{}, err
        }