1 src/cmd/compile/internal/ssa/testdata/hist.go
2 55: func test() {
3 57: l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}}
4 58: tinycall() // this forces l etc to stack
5 59: dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O)
6 l = {begin = {x = 1, y = 2}, end = {x = 3, y = 4}}
7 dx = <Optimized out, as expected>
8 dy = <Optimized out, as expected>
9 60: dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O)
10 dx = 2
11 dy = <Optimized out, as expected>
12 61: sink = dx + dy //gdb-opt=(dx,dy)
13 dx = 2
14 dy = 2
15 63: hist := make([]int, 7) //gdb-opt=(dx/O,dy/O) // TODO sink is missing if this code is in 'test' instead of 'main'
16 dx = 2
17 dy = <Optimized out, as expected>
18 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'
19 65: if len(os.Args) > 1 {
20 73: scanner := bufio.NewScanner(reader)
21 74: for scanner.Scan() { //gdb-opt=(scanner/A)
22 scanner = (bufio.Scanner *) <A>
23 75: s := scanner.Text()
24 76: i, err := strconv.ParseInt(s, 10, 64)
25 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
26 err = {tab = 0x0, data = 0x0}
27 hist = {array = 0xc00005ae50, len = 7, cap = 7}
28 i = 1
29 81: hist = ensure(int(i), hist)
30 82: hist[int(i)]++
31 75: s := scanner.Text()
32 76: i, err := strconv.ParseInt(s, 10, 64)
33 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
34 err = {tab = 0x0, data = 0x0}
35 hist = {array = 0xc00005ae50, len = 7, cap = 7}
36 i = 1
37 81: hist = ensure(int(i), hist)
38 82: hist[int(i)]++
39 75: s := scanner.Text()
40 76: i, err := strconv.ParseInt(s, 10, 64)
41 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
42 err = {tab = 0x0, data = 0x0}
43 hist = {array = 0xc00005ae50, len = 7, cap = 7}
44 i = 1
45 81: hist = ensure(int(i), hist)
46 82: hist[int(i)]++
47 75: s := scanner.Text()
48 76: i, err := strconv.ParseInt(s, 10, 64)
49 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
50 err = {tab = 0x0, data = 0x0}
51 hist = {array = 0xc00005ae50, len = 7, cap = 7}
52 i = 2
53 81: hist = ensure(int(i), hist)
54 82: hist[int(i)]++
55 75: s := scanner.Text()
56 76: i, err := strconv.ParseInt(s, 10, 64)
57 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
58 err = {tab = 0x0, data = 0x0}
59 hist = {array = 0xc00005ae50, len = 7, cap = 7}
60 i = 2
61 81: hist = ensure(int(i), hist)
62 82: hist[int(i)]++
63 75: s := scanner.Text()
64 76: i, err := strconv.ParseInt(s, 10, 64)
65 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
66 err = {tab = 0x0, data = 0x0}
67 hist = {array = 0xc00005ae50, len = 7, cap = 7}
68 i = 2
69 81: hist = ensure(int(i), hist)
70 82: hist[int(i)]++
71 75: s := scanner.Text()
72 76: i, err := strconv.ParseInt(s, 10, 64)
73 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
74 err = {tab = 0x0, data = 0x0}
75 hist = {array = 0xc00005ae50, len = 7, cap = 7}
76 i = 4
77 81: hist = ensure(int(i), hist)
78 82: hist[int(i)]++
79 75: s := scanner.Text()
80 76: i, err := strconv.ParseInt(s, 10, 64)
81 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
82 err = {tab = 0x0, data = 0x0}
83 hist = {array = 0xc00005ae50, len = 7, cap = 7}
84 i = 4
85 81: hist = ensure(int(i), hist)
86 82: hist[int(i)]++
87 75: s := scanner.Text()
88 76: i, err := strconv.ParseInt(s, 10, 64)
89 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
90 err = {tab = 0x0, data = 0x0}
91 hist = {array = 0xc00005ae50, len = 7, cap = 7}
92 i = 5
93 81: hist = ensure(int(i), hist)
94 82: hist[int(i)]++
95 86: for i, a := range hist {
96 87: if a == 0 { //gdb-opt=(a,n,t)
97 a = 0
98 n = 0
99 t = 0
100 86: for i, a := range hist {
101 87: if a == 0 { //gdb-opt=(a,n,t)
102 a = 3
103 n = 0
104 t = 0
105 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)
106 91: n += a
107 90: t += i * a
108 86: for i, a := range hist {
109 87: if a == 0 { //gdb-opt=(a,n,t)
110 a = 3
111 n = 3
112 t = 3
113 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)
114 91: n += a
115 90: t += i * a
116 86: for i, a := range hist {
117 87: if a == 0 { //gdb-opt=(a,n,t)
118 a = 0
119 n = 6
120 t = 9
121 86: for i, a := range hist {
122 87: if a == 0 { //gdb-opt=(a,n,t)
123 a = 2
124 n = 6
125 t = 9
126 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)
127 91: n += a
128 90: t += i * a
129 86: for i, a := range hist {
130 87: if a == 0 { //gdb-opt=(a,n,t)
131 a = 1
132 n = 8
133 t = 17
134 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)
135 91: n += a
136 90: t += i * a
137 86: for i, a := range hist {
138 87: if a == 0 { //gdb-opt=(a,n,t)
139 a = 0
140 n = 9
141 t = 22
142 86: for i, a := range hist {
143 99: }
144
View as plain text