From 518889b35cb07f3e71963f2ccfc0f96ee26a51ce Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Wed, 15 Feb 2023 16:11:37 -0800 Subject: [PATCH] cmd/compile: ensure InitMem comes after Args The debug info generation currently depends on this invariant. A small update to CL 468455. Update #58482 Change-Id: Ica305d360d9af04036c604b6a65b683f7cb6e212 Reviewed-on: https://go-review.googlesource.com/c/go/+/468695 Run-TryBot: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: Keith Randall Reviewed-by: David Chase --- src/cmd/compile/internal/ssa/schedule.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/ssa/schedule.go b/src/cmd/compile/internal/ssa/schedule.go index 679d1487d01..49bad25765a 100644 --- a/src/cmd/compile/internal/ssa/schedule.go +++ b/src/cmd/compile/internal/ssa/schedule.go @@ -15,6 +15,7 @@ import ( const ( ScorePhi = iota // towards top of block ScoreArg // must occur at the top of the entry block + ScoreInitMem // after the args - used as mark by debug info generation ScoreReadTuple // must occur immediately after tuple-generating insn (or call) ScoreNilCheck ScoreMemory @@ -162,9 +163,12 @@ 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 || v.Op == OpSP || v.Op == OpSB || v.Op == OpInitMem: + case v.Op == OpArg || v.Op == OpSP || v.Op == OpSB: // We want all the args as early as possible, for better debugging. score[v.ID] = ScoreArg + case v.Op == OpInitMem: + // Early, but after args. See debug.go:buildLocationLists + score[v.ID] = ScoreInitMem case v.Type.IsMemory(): // Schedule stores as early as possible. This tends to // reduce register pressure.