diff --git a/src/cmd/compile/internal/gc/bootstrap.go b/src/cmd/compile/internal/gc/bootstrap.go
deleted file mode 100644
index 37b0d59ede7a1da511a06a734c21143b809df93b..0000000000000000000000000000000000000000
--- a/src/cmd/compile/internal/gc/bootstrap.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.8
-// +build !go1.8
-
-package gc
-
-import (
-	"cmd/compile/internal/base"
-	"runtime"
-)
-
-func startMutexProfiling() {
-	base.Fatalf("mutex profiling unavailable in version %v", runtime.Version())
-}
diff --git a/src/cmd/compile/internal/gc/pprof.go b/src/cmd/compile/internal/gc/pprof.go
deleted file mode 100644
index 5f9b030621cb8acadcdf2cb53e42633c6419625f..0000000000000000000000000000000000000000
--- a/src/cmd/compile/internal/gc/pprof.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.8
-// +build go1.8
-
-package gc
-
-import "runtime"
-
-func startMutexProfiling() {
-	runtime.SetMutexProfileFraction(1)
-}
diff --git a/src/cmd/compile/internal/gc/trace.go b/src/cmd/compile/internal/gc/trace.go
deleted file mode 100644
index 8cdbd4b0f3a5da72fc3945e6d07badf7f262ca67..0000000000000000000000000000000000000000
--- a/src/cmd/compile/internal/gc/trace.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.7
-// +build go1.7
-
-package gc
-
-import (
-	"os"
-	tracepkg "runtime/trace"
-
-	"cmd/compile/internal/base"
-)
-
-func init() {
-	traceHandler = traceHandlerGo17
-}
-
-func traceHandlerGo17(traceprofile string) {
-	f, err := os.Create(traceprofile)
-	if err != nil {
-		base.Fatalf("%v", err)
-	}
-	if err := tracepkg.Start(f); err != nil {
-		base.Fatalf("%v", err)
-	}
-	base.AtExit(tracepkg.Stop)
-}
diff --git a/src/cmd/compile/internal/gc/util.go b/src/cmd/compile/internal/gc/util.go
index 56fd137de2374b96b9788417b809fec1e0a91388..dcac0ce79ae35a4fced71bf90b888145314b6398 100644
--- a/src/cmd/compile/internal/gc/util.go
+++ b/src/cmd/compile/internal/gc/util.go
@@ -8,12 +8,11 @@ import (
 	"os"
 	"runtime"
 	"runtime/pprof"
+	tracepkg "runtime/trace"
 
 	"cmd/compile/internal/base"
 )
 
-var traceHandler func(string)
-
 func startProfile() {
 	if base.Flag.CPUProfile != "" {
 		f, err := os.Create(base.Flag.CPUProfile)
@@ -64,13 +63,20 @@ func startProfile() {
 		if err != nil {
 			base.Fatalf("%v", err)
 		}
-		startMutexProfiling()
+		runtime.SetMutexProfileFraction(1)
 		base.AtExit(func() {
 			pprof.Lookup("mutex").WriteTo(f, 0)
 			f.Close()
 		})
 	}
-	if base.Flag.TraceProfile != "" && traceHandler != nil {
-		traceHandler(base.Flag.TraceProfile)
+	if base.Flag.TraceProfile != "" {
+		f, err := os.Create(base.Flag.TraceProfile)
+		if err != nil {
+			base.Fatalf("%v", err)
+		}
+		if err := tracepkg.Start(f); err != nil {
+			base.Fatalf("%v", err)
+		}
+		base.AtExit(tracepkg.Stop)
 	}
 }
diff --git a/src/cmd/compile/internal/logopt/escape.go b/src/cmd/compile/internal/logopt/escape.go
deleted file mode 100644
index 9660e938b4ae12ece29e11bd71f3160b741b4c8b..0000000000000000000000000000000000000000
--- a/src/cmd/compile/internal/logopt/escape.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.8
-// +build go1.8
-
-package logopt
-
-import "net/url"
-
-func pathEscape(s string) string {
-	return url.PathEscape(s)
-}
diff --git a/src/cmd/compile/internal/logopt/escape_bootstrap.go b/src/cmd/compile/internal/logopt/escape_bootstrap.go
deleted file mode 100644
index cc04eaadfd117256df6ceb3b0ee4820209230db1..0000000000000000000000000000000000000000
--- a/src/cmd/compile/internal/logopt/escape_bootstrap.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.8
-// +build !go1.8
-
-package logopt
-
-// For bootstrapping with an early version of Go
-func pathEscape(s string) string {
-	panic("This should never be called; the compiler is not fully bootstrapped if it is.")
-}
diff --git a/src/cmd/compile/internal/logopt/log_opts.go b/src/cmd/compile/internal/logopt/log_opts.go
index 9fee83426f60309e88e95f5b446e9a1182f30dcc..09825e8278fd4fec9975a64170f29230cec112a3 100644
--- a/src/cmd/compile/internal/logopt/log_opts.go
+++ b/src/cmd/compile/internal/logopt/log_opts.go
@@ -376,7 +376,7 @@ func writerForLSP(subdirpath, file string) io.WriteCloser {
 	if lastdot != -1 {
 		basename = basename[:lastdot]
 	}
-	basename = pathEscape(basename)
+	basename = url.PathEscape(basename)
 
 	// Assume a directory, make a file
 	p := filepath.Join(subdirpath, basename+".json")
@@ -428,7 +428,7 @@ func FlushLoggedOpts(ctxt *obj.Link, slashPkgPath string) {
 		if slashPkgPath == "" {
 			slashPkgPath = "\000"
 		}
-		subdirpath := filepath.Join(dest, pathEscape(slashPkgPath))
+		subdirpath := filepath.Join(dest, url.PathEscape(slashPkgPath))
 		err := os.MkdirAll(subdirpath, 0755)
 		if err != nil {
 			log.Fatalf("Could not create directory %s for logging optimizer actions, %v", subdirpath, err)
diff --git a/src/internal/pkgbits/frames_go1.go b/src/internal/pkgbits/frames_go1.go
deleted file mode 100644
index 5294f6a63edd7dcb5617fcd42a44f6b8dd241996..0000000000000000000000000000000000000000
--- a/src/internal/pkgbits/frames_go1.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.7
-// +build !go1.7
-
-// TODO(mdempsky): Remove after #44505 is resolved
-
-package pkgbits
-
-import "runtime"
-
-func walkFrames(pcs []uintptr, visit frameVisitor) {
-	for _, pc := range pcs {
-		fn := runtime.FuncForPC(pc)
-		file, line := fn.FileLine(pc)
-
-		visit(file, line, fn.Name(), pc-fn.Entry())
-	}
-}
diff --git a/src/internal/pkgbits/frames_go17.go b/src/internal/pkgbits/frames_go17.go
deleted file mode 100644
index 2324ae7adfe20de927093f5ed2410a4681a46cbc..0000000000000000000000000000000000000000
--- a/src/internal/pkgbits/frames_go17.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.7
-// +build go1.7
-
-package pkgbits
-
-import "runtime"
-
-// walkFrames calls visit for each call frame represented by pcs.
-//
-// pcs should be a slice of PCs, as returned by runtime.Callers.
-func walkFrames(pcs []uintptr, visit frameVisitor) {
-	if len(pcs) == 0 {
-		return
-	}
-
-	frames := runtime.CallersFrames(pcs)
-	for {
-		frame, more := frames.Next()
-		visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry)
-		if !more {
-			return
-		}
-	}
-}
diff --git a/src/internal/pkgbits/sync.go b/src/internal/pkgbits/sync.go
index 4b9ea4863f87ab2feb4b365d981b81e448bc3be2..72f776af05dc184ae5990de0fe5c428f2d406137 100644
--- a/src/internal/pkgbits/sync.go
+++ b/src/internal/pkgbits/sync.go
@@ -6,6 +6,7 @@ package pkgbits
 
 import (
 	"fmt"
+	"runtime"
 	"strings"
 )
 
@@ -34,6 +35,24 @@ func fmtFrames(pcs ...uintptr) []string {
 
 type frameVisitor func(file string, line int, name string, offset uintptr)
 
+// walkFrames calls visit for each call frame represented by pcs.
+//
+// pcs should be a slice of PCs, as returned by runtime.Callers.
+func walkFrames(pcs []uintptr, visit frameVisitor) {
+	if len(pcs) == 0 {
+		return
+	}
+
+	frames := runtime.CallersFrames(pcs)
+	for {
+		frame, more := frames.Next()
+		visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry)
+		if !more {
+			return
+		}
+	}
+}
+
 // SyncMarker is an enum type that represents markers that may be
 // written to export data to ensure the reader and writer stay
 // synchronized.
diff --git a/src/sort/slice.go b/src/sort/slice.go
index 443182b42ebfd83f18bb53189f604743a05a1b02..d0b2102013876cdd935d11867f7dd7a8fbbd4467 100644
--- a/src/sort/slice.go
+++ b/src/sort/slice.go
@@ -4,7 +4,10 @@
 
 package sort
 
-import "math/bits"
+import (
+	"internal/reflectlite"
+	"math/bits"
+)
 
 // Slice sorts the slice x given the provided less function.
 // It panics if x is not a slice.
@@ -16,8 +19,8 @@ import "math/bits"
 // The less function must satisfy the same requirements as
 // the Interface type's Less method.
 func Slice(x any, less func(i, j int) bool) {
-	rv := reflectValueOf(x)
-	swap := reflectSwapper(x)
+	rv := reflectlite.ValueOf(x)
+	swap := reflectlite.Swapper(x)
 	length := rv.Len()
 	limit := bits.Len(uint(length))
 	pdqsort_func(lessSwap{less, swap}, 0, length, limit)
@@ -30,15 +33,15 @@ func Slice(x any, less func(i, j int) bool) {
 // The less function must satisfy the same requirements as
 // the Interface type's Less method.
 func SliceStable(x any, less func(i, j int) bool) {
-	rv := reflectValueOf(x)
-	swap := reflectSwapper(x)
+	rv := reflectlite.ValueOf(x)
+	swap := reflectlite.Swapper(x)
 	stable_func(lessSwap{less, swap}, rv.Len())
 }
 
 // SliceIsSorted reports whether the slice x is sorted according to the provided less function.
 // It panics if x is not a slice.
 func SliceIsSorted(x any, less func(i, j int) bool) bool {
-	rv := reflectValueOf(x)
+	rv := reflectlite.ValueOf(x)
 	n := rv.Len()
 	for i := n - 1; i > 0; i-- {
 		if less(i, i-1) {
diff --git a/src/sort/slice_go113.go b/src/sort/slice_go113.go
deleted file mode 100644
index 53542dbd1a9b97cf97d6d16110332cec18b0a9c8..0000000000000000000000000000000000000000
--- a/src/sort/slice_go113.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.13
-// +build go1.13
-
-package sort
-
-import "internal/reflectlite"
-
-var reflectValueOf = reflectlite.ValueOf
-var reflectSwapper = reflectlite.Swapper
diff --git a/src/sort/slice_go14.go b/src/sort/slice_go14.go
deleted file mode 100644
index e4773676185bca9ea403f1cfccb338ade1bc85fa..0000000000000000000000000000000000000000
--- a/src/sort/slice_go14.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.8
-// +build !go1.8
-
-package sort
-
-import "reflect"
-
-var reflectValueOf = reflect.ValueOf
-
-func reflectSwapper(x any) func(int, int) {
-	v := reflectValueOf(x)
-	tmp := reflect.New(v.Type().Elem()).Elem()
-	return func(i, j int) {
-		a, b := v.Index(i), v.Index(j)
-		tmp.Set(a)
-		a.Set(b)
-		b.Set(tmp)
-	}
-}
diff --git a/src/sort/slice_go18.go b/src/sort/slice_go18.go
deleted file mode 100644
index 1538477bc5d205d815a97289c2a4bb5ba623d238..0000000000000000000000000000000000000000
--- a/src/sort/slice_go18.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.8 && !go1.13
-// +build go1.8,!go1.13
-
-package sort
-
-import "reflect"
-
-var reflectValueOf = reflect.ValueOf
-var reflectSwapper = reflect.Swapper