diff options
| author | Keith Randall <khr@golang.org> | 2023-01-20 13:54:36 -0800 |
|---|---|---|
| committer | Keith Randall <khr@google.com> | 2023-01-21 21:08:30 +0000 |
| commit | ba913774543d7388b7bb1843fc7c1b935aebedda (patch) | |
| tree | b5b82130bf3035db24bc1f07deb6d2c0f85352b8 /src/cmd/compile | |
| parent | 4ff074945a4848cd04c020b7f20ddaa1d78cc548 (diff) | |
| download | go-ba913774543d7388b7bb1843fc7c1b935aebedda.tar.xz | |
test: test that we schedule OpArgIntReg early
If OpArgIntReg is incorrectly scheduled, that causes it to be spilled
incorrectly, which causes the argument to not be considered live
at the start of the function.
This is the test for CL 462858
Add a brief mention of why CL 462858 is needed in the scheduling code.
Change-Id: Id199456f88d9ee5ca46d7b0353a3c2049709880e
Reviewed-on: https://go-review.googlesource.com/c/go/+/462899
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile')
| -rw-r--r-- | src/cmd/compile/internal/ssa/schedule.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/schedule.go b/src/cmd/compile/internal/ssa/schedule.go index 246376c767..4cd60d714c 100644 --- a/src/cmd/compile/internal/ssa/schedule.go +++ b/src/cmd/compile/internal/ssa/schedule.go @@ -130,8 +130,10 @@ func schedule(f *Func) { // We want all the phis first. score[v.ID] = ScorePhi case v.Op == OpArgIntReg || v.Op == OpArgFloatReg: - // In-register args must be scheduled as early as possible to ensure that the - // context register is not stomped. They should only appear in the entry block. + // In-register args must be scheduled as early as possible to ensure that they + // are not stomped (similar to the closure pointer above). + // In particular, they need to come before regular OpArg operations because + // of how regalloc places spill code (see regalloc.go:placeSpills:mustBeFirst). if b != f.Entry { f.Fatalf("%s appeared outside of entry block, b=%s", v.Op, b.String()) } |
