mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: reduce debugger-worsening line number churn
Reuse block head or preceding instruction's line number for register allocator's spill, fill, copy, rematerialization instructionsl; and also for phi, and for no-src-pos instructions. Assembler creates same line number tables for copy-predecessor-line and for no-src-pos, but copy-predecessor produces better-looking assembly language output with -S and with GOSSAFUNC, and does not require changes to tests of existing assembly language. Split "copyInto" into two cases, one for register allocation, one for otherwise. This caused the test score line change count to increase by one, which may reflect legitimately useful information preserved. Without any special treatment for copyInto, the change count increases by 21 more, from 51 to 72 (i.e., quite a lot). There is a test; using two naive "scores" for line number churn, the old numbering is 2x or 4x worse. Fixes #18902. Change-Id: I0a0a69659d30ee4e5d10116a0dd2b8c5df8457b1 Reviewed-on: https://go-review.googlesource.com/36207 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
1df777f6a4
commit
00263a8968
5 changed files with 340 additions and 6 deletions
|
|
@ -468,7 +468,7 @@ func (s *regAllocState) allocValToReg(v *Value, mask regMask, nospill bool, pos
|
|||
c = s.curBlock.NewValue1(pos, OpCopy, v.Type, s.regs[r2].c)
|
||||
} else if v.rematerializeable() {
|
||||
// Rematerialize instead of loading from the spill location.
|
||||
c = v.copyInto(s.curBlock)
|
||||
c = v.copyIntoNoXPos(s.curBlock)
|
||||
} else {
|
||||
// Load v from its spill location.
|
||||
spill := s.makeSpill(v, s.curBlock)
|
||||
|
|
@ -1949,13 +1949,13 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.XP
|
|||
e.s.f.Fatalf("can't find source for %s->%s: %s\n", e.p, e.b, v.LongString())
|
||||
}
|
||||
if dstReg {
|
||||
x = v.copyInto(e.p)
|
||||
x = v.copyIntoNoXPos(e.p)
|
||||
} else {
|
||||
// Rematerialize into stack slot. Need a free
|
||||
// register to accomplish this.
|
||||
e.erase(loc) // see pre-clobber comment below
|
||||
r := e.findRegFor(v.Type)
|
||||
x = v.copyInto(e.p)
|
||||
x = v.copyIntoNoXPos(e.p)
|
||||
e.set(r, vid, x, false, pos)
|
||||
// Make sure we spill with the size of the slot, not the
|
||||
// size of x (which might be wider due to our dropping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue