| 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 |
| 7 |
l.end.y = 4 |
| 8 |
60: dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O) |
| 9 |
61: sink = dx + dy //gdb-opt=(dx,dy) |
| 10 |
63: hist := make([]int, 7) //gdb-opt=(dx/O,dy/O) // TODO sink is missing if this code is in 'test' instead of 'main' |
| 11 |
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' |
| 12 |
hist = {array = <A>, len = 7, cap = 7} |
| 13 |
65: if len(os.Args) > 1 { |
| 14 |
73: scanner := bufio.NewScanner(reader) |
| 15 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 16 |
75: s := scanner.Text() |
| 17 |
76: i, err := strconv.ParseInt(s, 10, 64) |
| 18 |
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) |
| 19 |
i = 1 |
| 20 |
81: hist = ensure(int(i), hist) |
| 21 |
82: hist[int(i)]++ |
| 22 |
74: for scanner.Scan() { //gdb-opt=(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 |
i = 1 |
| 27 |
81: hist = ensure(int(i), hist) |
| 28 |
82: hist[int(i)]++ |
| 29 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 30 |
75: s := scanner.Text() |
| 31 |
76: i, err := strconv.ParseInt(s, 10, 64) |
| 32 |
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) |
| 33 |
i = 1 |
| 34 |
81: hist = ensure(int(i), hist) |
| 35 |
82: hist[int(i)]++ |
| 36 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 37 |
75: s := scanner.Text() |
| 38 |
76: i, err := strconv.ParseInt(s, 10, 64) |
| 39 |
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) |
| 40 |
i = 2 |
| 41 |
81: hist = ensure(int(i), hist) |
| 42 |
82: hist[int(i)]++ |
| 43 |
74: for scanner.Scan() { //gdb-opt=(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 |
i = 2 |
| 48 |
81: hist = ensure(int(i), hist) |
| 49 |
82: hist[int(i)]++ |
| 50 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 51 |
75: s := scanner.Text() |
| 52 |
76: i, err := strconv.ParseInt(s, 10, 64) |
| 53 |
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) |
| 54 |
i = 2 |
| 55 |
81: hist = ensure(int(i), hist) |
| 56 |
82: hist[int(i)]++ |
| 57 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 58 |
75: s := scanner.Text() |
| 59 |
76: i, err := strconv.ParseInt(s, 10, 64) |
| 60 |
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) |
| 61 |
i = 4 |
| 62 |
81: hist = ensure(int(i), hist) |
| 63 |
82: hist[int(i)]++ |
| 64 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 65 |
75: s := scanner.Text() |
| 66 |
76: i, err := strconv.ParseInt(s, 10, 64) |
| 67 |
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) |
| 68 |
i = 4 |
| 69 |
81: hist = ensure(int(i), hist) |
| 70 |
82: hist[int(i)]++ |
| 71 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 72 |
75: s := scanner.Text() |
| 73 |
76: i, err := strconv.ParseInt(s, 10, 64) |
| 74 |
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i) |
| 75 |
i = 5 |
| 76 |
81: hist = ensure(int(i), hist) |
| 77 |
82: hist[int(i)]++ |
| 78 |
74: for scanner.Scan() { //gdb-opt=(scanner/A) |
| 79 |
84: t := 0 |
| 80 |
85: n := 0 |
| 81 |
86: for i, a := range hist { |
| 82 |
87: if a == 0 { //gdb-opt=(a,n,t) |
| 83 |
88: continue |
| 84 |
86: for i, a := range hist { |
| 85 |
87: if a == 0 { //gdb-opt=(a,n,t) |
| 86 |
90: t += i * a |
| 87 |
91: n += a |
| 88 |
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) |
| 89 |
n = 3 |
| 90 |
i = 1 |
| 91 |
t = 3 |
| 92 |
86: for i, a := range hist { |
| 93 |
87: if a == 0 { //gdb-opt=(a,n,t) |
| 94 |
90: t += i * a |
| 95 |
91: n += a |
| 96 |
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) |
| 97 |
n = 6 |
| 98 |
i = 2 |
| 99 |
t = 9 |
| 100 |
86: for i, a := range hist { |
| 101 |
87: if a == 0 { //gdb-opt=(a,n,t) |
| 102 |
88: continue |
| 103 |
86: for i, a := range hist { |
| 104 |
87: if a == 0 { //gdb-opt=(a,n,t) |
| 105 |
90: t += i * a |
| 106 |
91: n += a |
| 107 |
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) |
| 108 |
n = 8 |
| 109 |
i = 4 |
| 110 |
t = 17 |
| 111 |
86: for i, a := range hist { |
| 112 |
87: if a == 0 { //gdb-opt=(a,n,t) |
| 113 |
90: t += i * a |
| 114 |
91: n += a |
| 115 |
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) |
| 116 |
n = 9 |
| 117 |
i = 5 |
| 118 |
t = 22 |
| 119 |
86: for i, a := range hist { |
| 120 |
87: if a == 0 { //gdb-opt=(a,n,t) |
| 121 |
88: continue |
| 122 |
86: for i, a := range hist { |
| 123 |
99: } |