1 // errorcheck -0 -d=ssa/likelyadjust/debug=1,ssa/insert_resched_checks/off
2 // rescheduling check insertion is turned off because the inserted conditional branches perturb the errorcheck
6 // Copyright 2016 The Go Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style
8 // license that can be found in the LICENSE file.
10 // Test that branches have some prediction properties.
13 func f(x, y, z int) int {
15 for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
16 for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
19 for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
26 func g(x, y, z int) int {
28 if y == 0 { // ERROR "Branch prediction rule default < call"
33 if y == x { // ERROR "Branch prediction rule default < call"
37 if y == 2 { // ERROR "Branch prediction rule default < call"
42 if y+z == 3 { // ERROR "Branch prediction rule call < exit"
45 panic("help help help")
47 if x != 0 { // ERROR "Branch prediction rule default < ret"
48 for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
49 if x == 4 { // ERROR "Branch prediction rule stay in loop"
52 for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
53 for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
63 func h(x, y, z int) int {
65 for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
66 for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
68 if i == j { // ERROR "Branch prediction rule stay in loop"
73 for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
81 if a > 0 { // ERROR "Branch prediction rule default < call"