Skip to content

Commit e7047bd

Browse files
cuonglmgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent a570823 commit e7047bd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/cmd/compile/internal/liveness/intervals.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ package liveness
4949
import (
5050
"fmt"
5151
"os"
52+
"slices"
5253
"strings"
5354
)
5455

@@ -131,11 +132,7 @@ func (c *IntervalsBuilder) setLast(x int) {
131132

132133
func (c *IntervalsBuilder) Finish() (Intervals, error) {
133134
// Reverse intervals list and check.
134-
// FIXME: replace with slices.Reverse once the
135-
// bootstrap version supports it.
136-
for i, j := 0, len(c.s)-1; i < j; i, j = i+1, j-1 {
137-
c.s[i], c.s[j] = c.s[j], c.s[i]
138-
}
135+
slices.Reverse(c.s)
139136
if err := check(c.s); err != nil {
140137
return Intervals{}, err
141138
}

0 commit comments

Comments
 (0)