Commit 46ba5902 authored by Cherry Zhang's avatar Cherry Zhang

cmd/compile: label LoadReg with line number of the use

A tentative fix of #16380. It adds "line" everywhere...

This also reduces binary size slightly (cmd/go on ARM as an example):

			before		after
total binary size	8068097		8018945 (-0.6%)
.gopclntab		1195341		1179929 (-1.3%)
.debug_line		 689692		 652017 (-5.5%)

Change-Id: Ibda657c6999783c5bac180cbbba487006dbf0ed7
Reviewed-on: https://go-review.googlesource.com/25082Reviewed-by: 's avatarDavid Chase <drchase@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 882dd1c3
...@@ -111,7 +111,7 @@ func dse(f *Func) { ...@@ -111,7 +111,7 @@ func dse(f *Func) {
if sz > 0x7fffffff { // work around sparseMap's int32 value type if sz > 0x7fffffff { // work around sparseMap's int32 value type
sz = 0x7fffffff sz = 0x7fffffff
} }
shadowed.set(v.Args[0].ID, int32(sz)) shadowed.set(v.Args[0].ID, int32(sz), 0)
} }
} }
// walk to previous store // walk to previous store
......
This diff is collapsed.
...@@ -10,6 +10,7 @@ package ssa ...@@ -10,6 +10,7 @@ package ssa
type sparseEntry struct { type sparseEntry struct {
key ID key ID
val int32 val int32
aux int32
} }
type sparseMap struct { type sparseMap struct {
...@@ -42,13 +43,14 @@ func (s *sparseMap) get(k ID) int32 { ...@@ -42,13 +43,14 @@ func (s *sparseMap) get(k ID) int32 {
return -1 return -1
} }
func (s *sparseMap) set(k ID, v int32) { func (s *sparseMap) set(k ID, v, a int32) {
i := s.sparse[k] i := s.sparse[k]
if i < int32(len(s.dense)) && s.dense[i].key == k { if i < int32(len(s.dense)) && s.dense[i].key == k {
s.dense[i].val = v s.dense[i].val = v
s.dense[i].aux = a
return return
} }
s.dense = append(s.dense, sparseEntry{k, v}) s.dense = append(s.dense, sparseEntry{k, v, a})
s.sparse[k] = int32(len(s.dense)) - 1 s.sparse[k] = int32(len(s.dense)) - 1
} }
...@@ -62,7 +64,7 @@ func (s *sparseMap) setBit(k ID, v uint) { ...@@ -62,7 +64,7 @@ func (s *sparseMap) setBit(k ID, v uint) {
s.dense[i].val |= 1 << v s.dense[i].val |= 1 << v
return return
} }
s.dense = append(s.dense, sparseEntry{k, 1 << v}) s.dense = append(s.dense, sparseEntry{k, 1 << v, 0})
s.sparse[k] = int32(len(s.dense)) - 1 s.sparse[k] = int32(len(s.dense)) - 1
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment