1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:54:42 -07:00

cmd/compile/internal/liveness: use slices.Reverse

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>
This commit is contained in:
Cuong Manh Le 2024-09-04 23:57:41 +07:00 committed by Gopher Robot
parent a5708231ac
commit e7047bd14d

View 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
}