From e7047bd14d78022d514566d15aed56fc5056d3e2 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Wed, 4 Sep 2024 23:57:41 +0700 Subject: [PATCH] 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 Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- src/cmd/compile/internal/liveness/intervals.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cmd/compile/internal/liveness/intervals.go b/src/cmd/compile/internal/liveness/intervals.go index feca35b306d..04b1ea50bad 100644 --- a/src/cmd/compile/internal/liveness/intervals.go +++ b/src/cmd/compile/internal/liveness/intervals.go @@ -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 }