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 57: l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}} 6 59: dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O) 7 l = {begin = {x = 1, y = 2}, end = {x = 3, y = 4}} 8 dx = <Optimized out, as expected> 9 dy = <Optimized out, as expected> 10 60: dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O) 11 dx = 2 12 dy = <Optimized out, as expected> 13 61: sink = dx + dy //gdb-opt=(dx,dy) 14 dx = 2 15 dy = 2 16 63: hist := make([]int, 7) //gdb-opt=(dx/O,dy/O) // TODO sink is missing if this code is in 'test' instead of 'main' 17 dx = <Optimized out, as expected> 18 dy = <Optimized out, as expected> 19 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' 20 65: if len(os.Args) > 1 { 21 73: scanner := bufio.NewScanner(reader) 22 74: for scanner.Scan() { //gdb-opt=(scanner/A) 23 scanner = (struct bufio.Scanner *) <A> 24 75: s := scanner.Text() 25 76: i, err := strconv.ParseInt(s, 10, 64) 26 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 27 err = {tab = 0x0, data = 0x0} 28 hist = []int = {0, 0, 0, 0, 0, 0, 0} 29 i = 1 30 81: hist = ensure(int(i), hist) 31 82: hist[int(i)]++ 32 74: for scanner.Scan() { //gdb-opt=(scanner/A) 33 scanner = (struct bufio.Scanner *) <A> 34 75: s := scanner.Text() 35 76: i, err := strconv.ParseInt(s, 10, 64) 36 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 37 err = {tab = 0x0, data = 0x0} 38 hist = []int = {0, 1, 0, 0, 0, 0, 0} 39 i = 1 40 81: hist = ensure(int(i), hist) 41 82: hist[int(i)]++ 42 74: for scanner.Scan() { //gdb-opt=(scanner/A) 43 scanner = (struct bufio.Scanner *) <A> 44 75: s := scanner.Text() 45 76: i, err := strconv.ParseInt(s, 10, 64) 46 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 47 err = {tab = 0x0, data = 0x0} 48 hist = []int = {0, 2, 0, 0, 0, 0, 0} 49 i = 1 50 81: hist = ensure(int(i), hist) 51 82: hist[int(i)]++ 52 74: for scanner.Scan() { //gdb-opt=(scanner/A) 53 scanner = (struct bufio.Scanner *) <A> 54 75: s := scanner.Text() 55 76: i, err := strconv.ParseInt(s, 10, 64) 56 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 57 err = {tab = 0x0, data = 0x0} 58 hist = []int = {0, 3, 0, 0, 0, 0, 0} 59 i = 2 60 81: hist = ensure(int(i), hist) 61 82: hist[int(i)]++ 62 74: for scanner.Scan() { //gdb-opt=(scanner/A) 63 scanner = (struct bufio.Scanner *) <A> 64 75: s := scanner.Text() 65 76: i, err := strconv.ParseInt(s, 10, 64) 66 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 67 err = {tab = 0x0, data = 0x0} 68 hist = []int = {0, 3, 1, 0, 0, 0, 0} 69 i = 2 70 81: hist = ensure(int(i), hist) 71 82: hist[int(i)]++ 72 74: for scanner.Scan() { //gdb-opt=(scanner/A) 73 scanner = (struct bufio.Scanner *) <A> 74 75: s := scanner.Text() 75 76: i, err := strconv.ParseInt(s, 10, 64) 76 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 77 err = {tab = 0x0, data = 0x0} 78 hist = []int = {0, 3, 2, 0, 0, 0, 0} 79 i = 2 80 81: hist = ensure(int(i), hist) 81 82: hist[int(i)]++ 82 74: for scanner.Scan() { //gdb-opt=(scanner/A) 83 scanner = (struct bufio.Scanner *) <A> 84 75: s := scanner.Text() 85 76: i, err := strconv.ParseInt(s, 10, 64) 86 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 87 err = {tab = 0x0, data = 0x0} 88 hist = []int = {0, 3, 3, 0, 0, 0, 0} 89 i = 4 90 81: hist = ensure(int(i), hist) 91 82: hist[int(i)]++ 92 74: for scanner.Scan() { //gdb-opt=(scanner/A) 93 scanner = (struct bufio.Scanner *) <A> 94 75: s := scanner.Text() 95 76: i, err := strconv.ParseInt(s, 10, 64) 96 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 97 err = {tab = 0x0, data = 0x0} 98 hist = []int = {0, 3, 3, 0, 1, 0, 0} 99 i = 4 100 81: hist = ensure(int(i), hist) 101 82: hist[int(i)]++ 102 74: for scanner.Scan() { //gdb-opt=(scanner/A) 103 scanner = (struct bufio.Scanner *) <A> 104 75: s := scanner.Text() 105 76: i, err := strconv.ParseInt(s, 10, 64) 106 77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) 107 err = {tab = 0x0, data = 0x0} 108 hist = []int = {0, 3, 3, 0, 2, 0, 0} 109 i = 5 110 81: hist = ensure(int(i), hist) 111 82: hist[int(i)]++ 112 74: for scanner.Scan() { //gdb-opt=(scanner/A) 113 scanner = (struct bufio.Scanner *) <A> 114 86: for i, a := range hist { 115 87: if a == 0 { //gdb-opt=(a,n,t) 116 a = 0 117 n = 0 118 t = 0 119 88: continue 120 87: if a == 0 { //gdb-opt=(a,n,t) 121 a = 3 122 n = 0 123 t = 0 124 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) 125 91: n += a 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 90: t += i * a 128 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) 129 90: t += i * a 130 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) 131 86: for i, a := range hist { 132 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) 133 87: if a == 0 { //gdb-opt=(a,n,t) 134 a = 3 135 n = 3 136 t = 3 137 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) 138 91: n += a 139 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) 140 90: t += i * a 141 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) 142 90: t += i * a 143 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) 144 86: for i, a := range hist { 145 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) 146 87: if a == 0 { //gdb-opt=(a,n,t) 147 a = 0 148 n = 6 149 t = 9 150 88: continue 151 87: if a == 0 { //gdb-opt=(a,n,t) 152 a = 2 153 n = 6 154 t = 9 155 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) 156 91: n += a 157 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) 158 90: t += i * a 159 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) 160 90: t += i * a 161 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) 162 86: for i, a := range hist { 163 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) 164 87: if a == 0 { //gdb-opt=(a,n,t) 165 a = 1 166 n = 8 167 t = 17 168 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) 169 91: n += a 170 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) 171 90: t += i * a 172 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) 173 90: t += i * a 174 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) 175 86: for i, a := range hist { 176 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) 177 87: if a == 0 { //gdb-opt=(a,n,t) 178 a = 0 179 n = 9 180 t = 22 181 88: continue 182 98: } 183