From: Keith Randall Date: Thu, 16 Feb 2023 00:11:37 +0000 (-0800) Subject: cmd/compile: ensure InitMem comes after Args X-Git-Tag: go1.21rc1~1549 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=518889b35cb07f3e71963f2ccfc0f96ee26a51ce;p=gostls13.git 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 --- diff --git a/src/cmd/compile/internal/ssa/schedule.go b/src/cmd/compile/internal/ssa/schedule.go index 679d1487d0..49bad25765 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.