2 // errorcheck -0 -d=ssa/likelyadjust/debug=1,ssa/insert_resched_checks/off
3 // rescheduling check insertion is turned off because the inserted conditional branches perturb the errorcheck
5 // Copyright 2016 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
9 // Test that branches have some prediction properties.
12 func f(x, y, z int) int {
14 for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
15 for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
18 for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
25 func g(x, y, z int) int {
27 if y == 0 { // ERROR "Branch prediction rule default < call"
32 if y == x { // ERROR "Branch prediction rule default < call"
36 if y == 2 { // ERROR "Branch prediction rule default < call"
41 if y+z == 3 { // ERROR "Branch prediction rule call < exit"
44 panic("help help help")
46 if x != 0 { // ERROR "Branch prediction rule default < ret"
47 for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
48 if x == 4 { // ERROR "Branch prediction rule stay in loop"
51 for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
52 for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
62 func h(x, y, z int) int {
64 for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
65 for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
67 if i == j { // ERROR "Branch prediction rule stay in loop"
72 for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
80 if a > 0 { // ERROR "Branch prediction rule default < call"