From 40ed3591829f67e7a116180aec543dd15bfcf5f9 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 14 Feb 2023 17:25:48 -0800 Subject: [PATCH] cmd/compile: schedule SP earlier The actual scheduling of SP early doesn't really matter, but lots of early spills (of arguments) depend on SP so they can't schedule until SP does. Fixes #58482 Change-Id: Ie581fba7cb173d665c11f797f39d824b1c040a2d Reviewed-on: https://go-review.googlesource.com/c/go/+/468455 TryBot-Result: Gopher Robot Reviewed-by: Alessandro Arzilli Reviewed-by: Keith Randall Run-TryBot: Keith Randall Reviewed-by: David Chase --- src/cmd/compile/internal/ssa/debug_lines_test.go | 2 +- src/cmd/compile/internal/ssa/schedule.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/ssa/debug_lines_test.go b/src/cmd/compile/internal/ssa/debug_lines_test.go index 268c4c41db..cf115107a1 100644 --- a/src/cmd/compile/internal/ssa/debug_lines_test.go +++ b/src/cmd/compile/internal/ssa/debug_lines_test.go @@ -114,7 +114,7 @@ func TestInlineLines(t *testing.T) { t.Skip("only runs for amd64 unless -arch explicitly supplied") } - want := [][]int{{3}, {3}, {4, 10}, {4, 10, 16}, {4, 10}, {4, 11, 16}, {4, 11}, {4}, {5, 10}, {5, 10, 16}, {5, 10}, {5, 11, 16}, {5, 11}, {5}} + want := [][]int{{3}, {4, 10}, {4, 10, 16}, {4, 10}, {4, 11, 16}, {4, 11}, {4}, {5, 10}, {5, 10, 16}, {5, 10}, {5, 11, 16}, {5, 11}, {5}} testInlineStack(t, "inline-dump.go", "f", want) } diff --git a/src/cmd/compile/internal/ssa/schedule.go b/src/cmd/compile/internal/ssa/schedule.go index c291e5c13f..679d1487d0 100644 --- a/src/cmd/compile/internal/ssa/schedule.go +++ b/src/cmd/compile/internal/ssa/schedule.go @@ -162,7 +162,7 @@ func schedule(f *Func) { f.Fatalf("%s appeared outside of entry block, b=%s", v.Op, b.String()) } score[v.ID] = ScorePhi - case v.Op == OpArg: + case v.Op == OpArg || v.Op == OpSP || v.Op == OpSB || v.Op == OpInitMem: // We want all the args as early as possible, for better debugging. score[v.ID] = ScoreArg case v.Type.IsMemory(): -- 2.48.1