mirror of
https://github.com/golang/go
synced 2024-11-18 20:04:52 -07:00
cmd/compile: remove statement marks from secondary calls
Calls are code-generated in an alternate path that inherits its positions from values, not from *SSAGenState. The default position on *SSAGenState was marked as not-a-statement, but this was not applied to the value itself, leading to spurious "is statement" marks in the output (convention: after code generation in the compiler, everything is either definitely a statement or definitely not a statement, nothing is in the undetermined state). This CL causes a 35 statement regression in ssa/stmtlines_test. This is down from the earlier 150 because of all the other CLs preceding this one that deal with the root causes of the missing lines (repeated lines on nested calls hid missing lines). This also removes some line repeats from ssa/debug_test. Change-Id: Ie9a507bd5447e906b35bbd098e3295211df2ae01 Reviewed-on: https://go-review.googlesource.com/c/go/+/188018 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
9a926911fe
commit
c450ace12c
@ -5238,8 +5238,11 @@ func (s *SSAGenState) DebugFriendlySetPosFrom(v *ssa.Value) {
|
||||
// in the generated code.
|
||||
if p.IsStmt() != src.PosIsStmt {
|
||||
p = p.WithNotStmt()
|
||||
// Calls use the pos attached to v, but copy the statement mark from SSAGenState
|
||||
}
|
||||
s.SetPos(p)
|
||||
} else {
|
||||
s.SetPos(s.pp.pos.WithNotStmt())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5878,10 +5881,15 @@ func (s *SSAGenState) AddrScratch(a *obj.Addr) {
|
||||
// Call returns a new CALL instruction for the SSA value v.
|
||||
// It uses PrepareCall to prepare the call.
|
||||
func (s *SSAGenState) Call(v *ssa.Value) *obj.Prog {
|
||||
pPosIsStmt := s.pp.pos.IsStmt() // The statement-ness fo the call comes from ssaGenState
|
||||
s.PrepareCall(v)
|
||||
|
||||
p := s.Prog(obj.ACALL)
|
||||
p.Pos = v.Pos
|
||||
if pPosIsStmt == src.PosIsStmt {
|
||||
p.Pos = v.Pos.WithIsStmt()
|
||||
} else {
|
||||
p.Pos = v.Pos.WithNotStmt()
|
||||
}
|
||||
if sym, ok := v.Aux.(*obj.LSym); ok {
|
||||
p.To.Type = obj.TYPE_MEM
|
||||
p.To.Name = obj.NAME_EXTERN
|
||||
|
@ -70,32 +70,24 @@
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
86: for i, a := range hist {
|
||||
|
@ -9,7 +9,7 @@ l.end.y = 4
|
||||
61: sink = dx + dy //gdb-opt=(dx,dy)
|
||||
63: hist := make([]int, 7) //gdb-opt=(dx/O,dy/O) // TODO sink is missing if this code is in 'test' instead of 'main'
|
||||
64: var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A) // TODO cannedInput/A is missing if this code is in 'test' instead of 'main'
|
||||
hist = []int = {0, 0, 0, 0, 0, 0, 0}
|
||||
hist = {array = <A>, len = 7, cap = 7}
|
||||
65: if len(os.Args) > 1 {
|
||||
73: scanner := bufio.NewScanner(reader)
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
|
@ -24,92 +24,74 @@ scanner = (bufio.Scanner *) <A>
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 0, 0, 0, 0, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 1
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 1, 0, 0, 0, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 1
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 2, 0, 0, 0, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 1
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 3, 0, 0, 0, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 2
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 3, 1, 0, 0, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 2
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 3, 2, 0, 0, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 2
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 3, 3, 0, 0, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 4
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 3, 3, 0, 1, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 4
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
75: s := scanner.Text()
|
||||
76: i, err := strconv.ParseInt(s, 10, 64)
|
||||
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
|
||||
err = {tab = 0x0, data = 0x0}
|
||||
hist = []int = {0, 3, 3, 0, 2, 0, 0}
|
||||
hist = {array = 0xc00005ae50, len = 7, cap = 7}
|
||||
i = 5
|
||||
81: hist = ensure(int(i), hist)
|
||||
82: hist[int(i)]++
|
||||
74: for scanner.Scan() { //gdb-opt=(scanner/A)
|
||||
scanner = (bufio.Scanner *) <A>
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
a = 0
|
||||
@ -122,9 +104,7 @@ n = 0
|
||||
t = 0
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
a = 3
|
||||
@ -132,9 +112,7 @@ n = 3
|
||||
t = 3
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
a = 0
|
||||
@ -147,9 +125,7 @@ n = 6
|
||||
t = 9
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
a = 1
|
||||
@ -157,9 +133,7 @@ n = 8
|
||||
t = 17
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
91: n += a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
90: t += i * a
|
||||
92: fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
|
||||
86: for i, a := range hist {
|
||||
87: if a == 0 { //gdb-opt=(a,n,t)
|
||||
a = 0
|
||||
|
Loading…
Reference in New Issue
Block a user