1; REQUIRES: asserts
2; RUN: opt -regions -analyze -enable-new-pm=0 < %s | FileCheck %s
3; RUN: opt -passes='print<regions>' -disable-output < %s 2>&1 | FileCheck %s
4
5; While working on improvements to the region info analysis, this test
6; case caused an incorrect region 3 => 8 to be detected.
7
8define internal i8 @wibble() {
9bb:
10  br i1 true, label %bb1, label %bb8
11
12bb1:                                              ; preds = %bb
13  switch i32 0, label %bb2 [
14    i32 0, label %bb3
15    i32 1, label %bb7
16  ]
17
18bb2:                                              ; preds = %bb1
19  br label %bb4
20
21bb3:                                              ; preds = %bb1
22  br label %bb5
23
24bb4:                                              ; preds = %bb2
25  br label %bb6
26
27bb5:                                              ; preds = %bb3
28  br label %bb6
29
30bb6:                                              ; preds = %bb5, %bb4
31  br label %bb7
32
33bb7:                                              ; preds = %bb6, %bb1
34  br label %bb8
35
36bb8:                                              ; preds = %bb7, %bb
37  ret i8 1
38}
39
40; CHECK:      [0] bb => <Function Return>
41; CHECK-NEXT:   [1] bb => bb8
42; CHECK-NEXT:     [2] bb1 => bb7
43; CHECK-NEXT: End region tree
44
45