summaryrefslogtreecommitdiffstats
path: root/src/cmd/compile/internal/ssa/testdata
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 13:16:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 13:16:40 +0000
commit47ab3d4a42e9ab51c465c4322d2ec233f6324e6b (patch)
treea61a0ffd83f4a3def4b36e5c8e99630c559aa723 /src/cmd/compile/internal/ssa/testdata
parentInitial commit. (diff)
downloadgolang-1.18-upstream.tar.xz
golang-1.18-upstream.zip
Adding upstream version 1.18.10.upstream/1.18.10upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/testdata')
-rw-r--r--src/cmd/compile/internal/ssa/testdata/convertline.go16
-rw-r--r--src/cmd/compile/internal/ssa/testdata/hist.dlv-dbg.nexts99
-rw-r--r--src/cmd/compile/internal/ssa/testdata/hist.dlv-opt.nexts94
-rw-r--r--src/cmd/compile/internal/ssa/testdata/hist.gdb-dbg.nexts123
-rw-r--r--src/cmd/compile/internal/ssa/testdata/hist.gdb-opt.nexts143
-rw-r--r--src/cmd/compile/internal/ssa/testdata/hist.go106
-rw-r--r--src/cmd/compile/internal/ssa/testdata/i22558.dlv-dbg.nexts11
-rw-r--r--src/cmd/compile/internal/ssa/testdata/i22558.gdb-dbg.nexts11
-rw-r--r--src/cmd/compile/internal/ssa/testdata/i22558.go51
-rw-r--r--src/cmd/compile/internal/ssa/testdata/i22600.dlv-dbg-race.nexts7
-rw-r--r--src/cmd/compile/internal/ssa/testdata/i22600.gdb-dbg-race.nexts7
-rw-r--r--src/cmd/compile/internal/ssa/testdata/i22600.go27
-rw-r--r--src/cmd/compile/internal/ssa/testdata/infloop.dlv-opt.nexts12
-rw-r--r--src/cmd/compile/internal/ssa/testdata/infloop.gdb-opt.nexts4
-rw-r--r--src/cmd/compile/internal/ssa/testdata/infloop.go16
-rw-r--r--src/cmd/compile/internal/ssa/testdata/inline-dump.go17
-rw-r--r--src/cmd/compile/internal/ssa/testdata/pushback.go30
-rw-r--r--src/cmd/compile/internal/ssa/testdata/sayhi.go12
-rw-r--r--src/cmd/compile/internal/ssa/testdata/scopes.dlv-dbg.nexts56
-rw-r--r--src/cmd/compile/internal/ssa/testdata/scopes.dlv-opt.nexts46
-rw-r--r--src/cmd/compile/internal/ssa/testdata/scopes.gdb-dbg.nexts64
-rw-r--r--src/cmd/compile/internal/ssa/testdata/scopes.gdb-opt.nexts55
-rw-r--r--src/cmd/compile/internal/ssa/testdata/scopes.go107
23 files changed, 1114 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/testdata/convertline.go b/src/cmd/compile/internal/ssa/testdata/convertline.go
new file mode 100644
index 0000000..08f3ae8
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/convertline.go
@@ -0,0 +1,16 @@
+package main
+
+import "fmt"
+
+func F[T any](n T) {
+ fmt.Printf("called\n")
+}
+
+func G[T any](n T) {
+ F(n)
+ fmt.Printf("after\n")
+}
+
+func main() {
+ G(3)
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/hist.dlv-dbg.nexts b/src/cmd/compile/internal/ssa/testdata/hist.dlv-dbg.nexts
new file mode 100644
index 0000000..a0404e4
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/hist.dlv-dbg.nexts
@@ -0,0 +1,99 @@
+ ./testdata/hist.go
+55: func test() {
+57: l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}}
+58: tinycall() // this forces l etc to stack
+59: dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O)
+60: dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O)
+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'
+65: if len(os.Args) > 1 {
+73: scanner := bufio.NewScanner(reader)
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(scanner/A)
+84: t := 0
+85: n := 0
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+88: continue
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+88: continue
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+88: continue
+86: for i, a := range hist {
+99: }
diff --git a/src/cmd/compile/internal/ssa/testdata/hist.dlv-opt.nexts b/src/cmd/compile/internal/ssa/testdata/hist.dlv-opt.nexts
new file mode 100644
index 0000000..2be83ce
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/hist.dlv-opt.nexts
@@ -0,0 +1,94 @@
+ ./testdata/hist.go
+55: func test() {
+57: l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}}
+58: tinycall() // this forces l etc to stack
+59: dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O)
+60: dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O)
+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'
+65: if len(os.Args) > 1 {
+73: scanner := bufio.NewScanner(reader)
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(scanner/A)
+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
+90: t += i * a
+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
+90: t += i * a
+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
+90: t += i * a
+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
+90: t += i * a
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+86: for i, a := range hist {
+99: }
diff --git a/src/cmd/compile/internal/ssa/testdata/hist.gdb-dbg.nexts b/src/cmd/compile/internal/ssa/testdata/hist.gdb-dbg.nexts
new file mode 100644
index 0000000..72df60c
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/hist.gdb-dbg.nexts
@@ -0,0 +1,123 @@
+ src/cmd/compile/internal/ssa/testdata/hist.go
+55: func test() {
+57: l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}}
+58: tinycall() // this forces l etc to stack
+59: dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O)
+l.begin.x = 1
+l.end.y = 4
+60: dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O)
+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 = {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)
+75: s := scanner.Text()
+76: i, err := strconv.ParseInt(s, 10, 64)
+77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
+i = 1
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 1
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 1
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 2
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 2
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 2
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 4
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 4
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(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)
+i = 5
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+74: for scanner.Scan() { //gdb-opt=(scanner/A)
+84: t := 0
+85: n := 0
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+88: continue
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+n = 3
+i = 1
+t = 3
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+n = 6
+i = 2
+t = 9
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+88: continue
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+n = 8
+i = 4
+t = 17
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+90: t += i * a
+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)
+n = 9
+i = 5
+t = 22
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+88: continue
+86: for i, a := range hist {
+99: }
diff --git a/src/cmd/compile/internal/ssa/testdata/hist.gdb-opt.nexts b/src/cmd/compile/internal/ssa/testdata/hist.gdb-opt.nexts
new file mode 100644
index 0000000..d3a34ac
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/hist.gdb-opt.nexts
@@ -0,0 +1,143 @@
+ src/cmd/compile/internal/ssa/testdata/hist.go
+55: func test() {
+57: l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}}
+58: tinycall() // this forces l etc to stack
+59: dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O)
+l = {begin = {x = 1, y = 2}, end = {x = 3, y = 4}}
+dx = <Optimized out, as expected>
+dy = <Optimized out, as expected>
+60: dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O)
+dx = 2
+dy = <Optimized out, as expected>
+61: sink = dx + dy //gdb-opt=(dx,dy)
+dx = 2
+dy = 2
+63: hist := make([]int, 7) //gdb-opt=(dx/O,dy/O) // TODO sink is missing if this code is in 'test' instead of 'main'
+dx = 2
+dy = <Optimized out, as expected>
+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'
+65: if len(os.Args) > 1 {
+73: scanner := bufio.NewScanner(reader)
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 1
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 1
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 1
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 2
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 2
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 2
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 4
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 4
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+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 = {array = 0xc00005ae50, len = 7, cap = 7}
+i = 5
+81: hist = ensure(int(i), hist)
+82: hist[int(i)]++
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+a = 0
+n = 0
+t = 0
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+a = 3
+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
+90: t += i * a
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+a = 3
+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
+90: t += i * a
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+a = 0
+n = 6
+t = 9
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+a = 2
+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
+90: t += i * a
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+a = 1
+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
+90: t += i * a
+86: for i, a := range hist {
+87: if a == 0 { //gdb-opt=(a,n,t)
+a = 0
+n = 9
+t = 22
+86: for i, a := range hist {
+99: }
diff --git a/src/cmd/compile/internal/ssa/testdata/hist.go b/src/cmd/compile/internal/ssa/testdata/hist.go
new file mode 100644
index 0000000..f8fa6e6
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/hist.go
@@ -0,0 +1,106 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This is the input program for an end-to-end test of the DWARF produced
+// by the compiler. It is compiled with various flags, then the resulting
+// binary is "debugged" under the control of a harness. Because the compile+debug
+// step is time-consuming, the tests for different bugs are all accumulated here
+// so that their cost is only the time to "n" through the additional code.
+
+package main
+
+import (
+ "bufio"
+ "fmt"
+ "io"
+ "os"
+ "strconv"
+ "strings"
+)
+
+type point struct {
+ x, y int
+}
+
+type line struct {
+ begin, end point
+}
+
+var zero int
+var sink int
+
+//go:noinline
+func tinycall() {
+}
+
+func ensure(n int, sl []int) []int {
+ for len(sl) <= n {
+ sl = append(sl, 0)
+ }
+ return sl
+}
+
+var cannedInput string = `1
+1
+1
+2
+2
+2
+4
+4
+5
+`
+
+func test() {
+ // For #19868
+ l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}}
+ tinycall() // this forces l etc to stack
+ dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O)
+ dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O)
+ sink = dx + dy //gdb-opt=(dx,dy)
+ // For #21098
+ hist := make([]int, 7) //gdb-opt=(dx/O,dy/O) // TODO sink is missing if this code is in 'test' instead of 'main'
+ 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'
+ if len(os.Args) > 1 {
+ var err error
+ reader, err = os.Open(os.Args[1])
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "There was an error opening %s: %v\n", os.Args[1], err)
+ return
+ }
+ }
+ scanner := bufio.NewScanner(reader)
+ for scanner.Scan() { //gdb-opt=(scanner/A)
+ s := scanner.Text()
+ i, err := strconv.ParseInt(s, 10, 64)
+ if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
+ fmt.Fprintf(os.Stderr, "There was an error: %v\n", err)
+ return
+ }
+ hist = ensure(int(i), hist)
+ hist[int(i)]++
+ }
+ t := 0
+ n := 0
+ for i, a := range hist {
+ if a == 0 { //gdb-opt=(a,n,t)
+ continue
+ }
+ t += i * a
+ n += a
+ 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)
+ }
+}
+
+func main() {
+ growstack() // Use stack early to prevent growth during test, which confuses gdb
+ test()
+}
+
+var snk string
+
+//go:noinline
+func growstack() {
+ snk = fmt.Sprintf("%#v,%#v,%#v", 1, true, "cat")
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/i22558.dlv-dbg.nexts b/src/cmd/compile/internal/ssa/testdata/i22558.dlv-dbg.nexts
new file mode 100644
index 0000000..a00934b
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/i22558.dlv-dbg.nexts
@@ -0,0 +1,11 @@
+ ./testdata/i22558.go
+19: func test(t *thing, u *thing) {
+20: if t.next != nil {
+23: fmt.Fprintf(os.Stderr, "%s\n", t.name)
+24: u.self = u
+25: t.self = t
+26: t.next = u
+27: for _, p := range t.stuff {
+28: if isFoo(t, p) {
+29: return
+44: }
diff --git a/src/cmd/compile/internal/ssa/testdata/i22558.gdb-dbg.nexts b/src/cmd/compile/internal/ssa/testdata/i22558.gdb-dbg.nexts
new file mode 100644
index 0000000..70dfa07
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/i22558.gdb-dbg.nexts
@@ -0,0 +1,11 @@
+ src/cmd/compile/internal/ssa/testdata/i22558.go
+19: func test(t *thing, u *thing) {
+20: if t.next != nil {
+23: fmt.Fprintf(os.Stderr, "%s\n", t.name)
+24: u.self = u
+25: t.self = t
+26: t.next = u
+27: for _, p := range t.stuff {
+28: if isFoo(t, p) {
+29: return
+44: }
diff --git a/src/cmd/compile/internal/ssa/testdata/i22558.go b/src/cmd/compile/internal/ssa/testdata/i22558.go
new file mode 100644
index 0000000..8aea76c
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/i22558.go
@@ -0,0 +1,51 @@
+package main
+
+import (
+ "fmt"
+ "os"
+)
+
+type big struct {
+ pile [768]int8
+}
+
+type thing struct {
+ name string
+ next *thing
+ self *thing
+ stuff []big
+}
+
+func test(t *thing, u *thing) {
+ if t.next != nil {
+ return
+ }
+ fmt.Fprintf(os.Stderr, "%s\n", t.name)
+ u.self = u
+ t.self = t
+ t.next = u
+ for _, p := range t.stuff {
+ if isFoo(t, p) {
+ return
+ }
+ }
+}
+
+//go:noinline
+func isFoo(t *thing, b big) bool {
+ return true
+}
+
+func main() {
+ growstack() // Use stack early to prevent growth during test, which confuses gdb
+ t := &thing{name: "t", self: nil, next: nil, stuff: make([]big, 1)}
+ u := thing{name: "u", self: t, next: t, stuff: make([]big, 1)}
+ test(t, &u)
+}
+
+var snk string
+
+//go:noinline
+func growstack() {
+ snk = fmt.Sprintf("%#v,%#v,%#v", 1, true, "cat")
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/i22600.dlv-dbg-race.nexts b/src/cmd/compile/internal/ssa/testdata/i22600.dlv-dbg-race.nexts
new file mode 100644
index 0000000..18a5ff9
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/i22600.dlv-dbg-race.nexts
@@ -0,0 +1,7 @@
+ ./testdata/i22600.go
+8: func test() {
+9: pwd, err := os.Getwd()
+10: if err != nil {
+14: fmt.Println(pwd)
+15: }
+20: }
diff --git a/src/cmd/compile/internal/ssa/testdata/i22600.gdb-dbg-race.nexts b/src/cmd/compile/internal/ssa/testdata/i22600.gdb-dbg-race.nexts
new file mode 100644
index 0000000..46285e2
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/i22600.gdb-dbg-race.nexts
@@ -0,0 +1,7 @@
+ src/cmd/compile/internal/ssa/testdata/i22600.go
+8: func test() {
+9: pwd, err := os.Getwd()
+10: if err != nil {
+14: fmt.Println(pwd)
+15: }
+20: }
diff --git a/src/cmd/compile/internal/ssa/testdata/i22600.go b/src/cmd/compile/internal/ssa/testdata/i22600.go
new file mode 100644
index 0000000..27f0d3d
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/i22600.go
@@ -0,0 +1,27 @@
+package main
+
+import (
+ "fmt"
+ "os"
+)
+
+func test() {
+ pwd, err := os.Getwd()
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ fmt.Println(pwd)
+}
+
+func main() {
+ growstack() // Use stack early to prevent growth during test, which confuses gdb
+ test()
+}
+
+var snk string
+
+//go:noinline
+func growstack() {
+ snk = fmt.Sprintf("%#v,%#v,%#v", 1, true, "cat")
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/infloop.dlv-opt.nexts b/src/cmd/compile/internal/ssa/testdata/infloop.dlv-opt.nexts
new file mode 100644
index 0000000..0b9f06f
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/infloop.dlv-opt.nexts
@@ -0,0 +1,12 @@
+ ./testdata/infloop.go
+6: func test() {
+8: go func() {}()
+10: for {
+1: package main
+10: for {
+1: package main
+10: for {
+1: package main
+10: for {
+1: package main
+10: for {
diff --git a/src/cmd/compile/internal/ssa/testdata/infloop.gdb-opt.nexts b/src/cmd/compile/internal/ssa/testdata/infloop.gdb-opt.nexts
new file mode 100644
index 0000000..d465ad1
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/infloop.gdb-opt.nexts
@@ -0,0 +1,4 @@
+ src/cmd/compile/internal/ssa/testdata/infloop.go
+6: func test() {
+8: go func() {}()
+10: for {
diff --git a/src/cmd/compile/internal/ssa/testdata/infloop.go b/src/cmd/compile/internal/ssa/testdata/infloop.go
new file mode 100644
index 0000000..cdb374f
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/infloop.go
@@ -0,0 +1,16 @@
+package main
+
+var sink int
+
+//go:noinline
+func test() {
+ // This is for #30167, incorrect line numbers in an infinite loop
+ go func() {}()
+
+ for {
+ }
+}
+
+func main() {
+ test()
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/inline-dump.go b/src/cmd/compile/internal/ssa/testdata/inline-dump.go
new file mode 100644
index 0000000..97893b6
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/inline-dump.go
@@ -0,0 +1,17 @@
+package foo
+
+func f(m, n int) int {
+ a := g(n)
+ b := g(m)
+ return a + b
+}
+
+func g(x int) int {
+ y := h(x + 1)
+ z := h(x - 1)
+ return y + z
+}
+
+func h(x int) int {
+ return x * x
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/pushback.go b/src/cmd/compile/internal/ssa/testdata/pushback.go
new file mode 100644
index 0000000..754e6cb
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/pushback.go
@@ -0,0 +1,30 @@
+package main
+
+type Node struct {
+ Circular bool
+}
+
+type ExtNode[V any] struct {
+ v V
+ Node
+}
+
+type List[V any] struct {
+ root *ExtNode[V]
+ len int
+}
+
+func (list *List[V]) PushBack(arg V) {
+ if list.len == 0 {
+ list.root = &ExtNode[V]{v: arg}
+ list.root.Circular = true
+ list.len++
+ return
+ }
+ list.len++
+}
+
+func main() {
+ var v List[int]
+ v.PushBack(1)
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/sayhi.go b/src/cmd/compile/internal/ssa/testdata/sayhi.go
new file mode 100644
index 0000000..680e1eb
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/sayhi.go
@@ -0,0 +1,12 @@
+package foo
+
+import (
+ "fmt"
+ "sync"
+)
+
+func sayhi(n int, wg *sync.WaitGroup) {
+ fmt.Println("hi", n)
+ fmt.Println("hi", n)
+ wg.Done()
+}
diff --git a/src/cmd/compile/internal/ssa/testdata/scopes.dlv-dbg.nexts b/src/cmd/compile/internal/ssa/testdata/scopes.dlv-dbg.nexts
new file mode 100644
index 0000000..f182ff4
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/scopes.dlv-dbg.nexts
@@ -0,0 +1,56 @@
+ ./testdata/scopes.go
+22: func test() {
+23: x := id(0)
+24: y := id(0)
+25: fmt.Println(x)
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+26: for i := x; i < 3; i++ {
+30: y = x + y //gdb-dbg=(x,y)//gdb-opt=(x,y)
+31: fmt.Println(x, y)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+34: a := y
+35: f1(a)
+37: b := 0
+38: f2(b)
+39: if gretbool() {
+40: c := 0
+41: f3(c)
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+34: a := y
+35: f1(a)
+37: b := 0
+38: f2(b)
+39: if gretbool() {
+43: c := 1.1
+44: f4(int(c))
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+53: j = id(1)
+54: f = id(2)
+56: for i := 0; i <= 5; i++ {
+57: j += j * (j ^ 3) / 100
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+57: j += j * (j ^ 3) / 100
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+57: j += j * (j ^ 3) / 100
+58: if i == f {
+59: fmt.Println("foo")
+60: break
+64: helloworld()
+66: }
+15: }
diff --git a/src/cmd/compile/internal/ssa/testdata/scopes.dlv-opt.nexts b/src/cmd/compile/internal/ssa/testdata/scopes.dlv-opt.nexts
new file mode 100644
index 0000000..b5e41aa
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/scopes.dlv-opt.nexts
@@ -0,0 +1,46 @@
+ ./testdata/scopes.go
+22: func test() {
+23: x := id(0)
+24: y := id(0)
+25: fmt.Println(x)
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+26: for i := x; i < 3; i++ {
+31: fmt.Println(x, y)
+30: y = x + y //gdb-dbg=(x,y)//gdb-opt=(x,y)
+31: fmt.Println(x, y)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+35: f1(a)
+38: f2(b)
+39: if gretbool() {
+41: f3(c)
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+35: f1(a)
+38: f2(b)
+39: if gretbool() {
+44: f4(int(c))
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+53: j = id(1)
+54: f = id(2)
+56: for i := 0; i <= 5; i++ {
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+58: if i == f {
+59: fmt.Println("foo")
+64: helloworld()
+15: }
diff --git a/src/cmd/compile/internal/ssa/testdata/scopes.gdb-dbg.nexts b/src/cmd/compile/internal/ssa/testdata/scopes.gdb-dbg.nexts
new file mode 100644
index 0000000..6eb4903
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/scopes.gdb-dbg.nexts
@@ -0,0 +1,64 @@
+ src/cmd/compile/internal/ssa/testdata/scopes.go
+22: func test() {
+23: x := id(0)
+24: y := id(0)
+25: fmt.Println(x)
+0:
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 0
+y = 0
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 1
+y = 0
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 4
+y = 1
+26: for i := x; i < 3; i++ {
+30: y = x + y //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 0
+y = 5
+31: fmt.Println(x, y)
+0: 5
+34: a := y
+35: f1(a)
+37: b := 0
+38: f2(b)
+39: if gretbool() {
+40: c := 0
+41: f3(c)
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+34: a := y
+35: f1(a)
+37: b := 0
+38: f2(b)
+39: if gretbool() {
+43: c := 1.1
+44: f4(int(c))
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+53: j = id(1)
+54: f = id(2)
+56: for i := 0; i <= 5; i++ {
+57: j += j * (j ^ 3) / 100
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+57: j += j * (j ^ 3) / 100
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+57: j += j * (j ^ 3) / 100
+58: if i == f {
+59: fmt.Println("foo")
+60: break
+64: helloworld()
+66: }
+15: }
diff --git a/src/cmd/compile/internal/ssa/testdata/scopes.gdb-opt.nexts b/src/cmd/compile/internal/ssa/testdata/scopes.gdb-opt.nexts
new file mode 100644
index 0000000..5a186b5
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/scopes.gdb-opt.nexts
@@ -0,0 +1,55 @@
+ src/cmd/compile/internal/ssa/testdata/scopes.go
+22: func test() {
+23: x := id(0)
+24: y := id(0)
+25: fmt.Println(x)
+0:
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 0
+y = 0
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 1
+y = 0
+26: for i := x; i < 3; i++ {
+27: x := i * i
+28: y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 4
+y = 1
+26: for i := x; i < 3; i++ {
+31: fmt.Println(x, y)
+30: y = x + y //gdb-dbg=(x,y)//gdb-opt=(x,y)
+x = 0
+y = 5
+31: fmt.Println(x, y)
+0: 5
+35: f1(a)
+38: f2(b)
+39: if gretbool() {
+41: f3(c)
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+35: f1(a)
+38: f2(b)
+39: if gretbool() {
+44: f4(int(c))
+46: f5(b)
+48: f6(a)
+33: for x := 0; x <= 1; x++ { // From delve scopetest.go
+53: j = id(1)
+54: f = id(2)
+56: for i := 0; i <= 5; i++ {
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+58: if i == f {
+62: sleepytime()
+56: for i := 0; i <= 5; i++ {
+58: if i == f {
+59: fmt.Println("foo")
+64: helloworld()
+66: }
+15: }
diff --git a/src/cmd/compile/internal/ssa/testdata/scopes.go b/src/cmd/compile/internal/ssa/testdata/scopes.go
new file mode 100644
index 0000000..e93d699
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/testdata/scopes.go
@@ -0,0 +1,107 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "fmt"
+ "time"
+)
+
+func main() {
+ growstack() // Use stack early to prevent growth during test, which confuses gdb
+ test()
+}
+
+//go:noinline
+func id(x int) int {
+ return x
+}
+
+func test() {
+ x := id(0)
+ y := id(0)
+ fmt.Println(x)
+ for i := x; i < 3; i++ {
+ x := i * i
+ y += id(x) //gdb-dbg=(x,y)//gdb-opt=(x,y)
+ }
+ y = x + y //gdb-dbg=(x,y)//gdb-opt=(x,y)
+ fmt.Println(x, y)
+
+ for x := 0; x <= 1; x++ { // From delve scopetest.go
+ a := y
+ f1(a)
+ {
+ b := 0
+ f2(b)
+ if gretbool() {
+ c := 0
+ f3(c)
+ } else {
+ c := 1.1
+ f4(int(c))
+ }
+ f5(b)
+ }
+ f6(a)
+ }
+
+ { // From delve testnextprog.go
+ var (
+ j = id(1)
+ f = id(2)
+ )
+ for i := 0; i <= 5; i++ {
+ j += j * (j ^ 3) / 100
+ if i == f {
+ fmt.Println("foo")
+ break
+ }
+ sleepytime()
+ }
+ helloworld()
+ }
+}
+
+func sleepytime() {
+ time.Sleep(5 * time.Millisecond)
+}
+
+func helloworld() {
+ fmt.Println("Hello, World!")
+}
+
+//go:noinline
+func f1(x int) {}
+
+//go:noinline
+func f2(x int) {}
+
+//go:noinline
+func f3(x int) {}
+
+//go:noinline
+func f4(x int) {}
+
+//go:noinline
+func f5(x int) {}
+
+//go:noinline
+func f6(x int) {}
+
+var boolvar = true
+
+func gretbool() bool {
+ x := boolvar
+ boolvar = !boolvar
+ return x
+}
+
+var sink string
+
+//go:noinline
+func growstack() {
+ sink = fmt.Sprintf("%#v,%#v,%#v", 1, true, "cat")
+}