1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; REQUIRES: asserts
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes='require<domtree>,loop(simplify-cfg)' -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -loop-simplifycfg -enable-mssa-loop-dependency=true -verify-memoryssa -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"
define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT: br label [[BB1:%.*]]
; CHECK: bb1.loopexit:
; CHECK-NEXT: br label [[BB1]]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb2.loopexit:
; CHECK-NEXT: br label [[BB2]]
; CHECK: bb2:
; CHECK-NEXT: switch i32 0, label [[BB2_SPLIT:%.*]] [
; CHECK-NEXT: i32 1, label [[BB1_LOOPEXIT:%.*]]
; CHECK-NEXT: i32 2, label [[BB2_LOOPEXIT:%.*]]
; CHECK-NEXT: ]
; CHECK: bb2.split:
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
; CHECK-NEXT: br label [[BB3]]
;
br label %bb1
bb1: ; preds = %bb4, %0
br label %bb2
bb2: ; preds = %bb6, %bb1
br label %bb3
bb3: ; preds = %bb8, %bb3, %bb2
br i1 false, label %bb4, label %bb3
bb4: ; preds = %bb8, %bb3
br i1 undef, label %bb1, label %bb6
bb6: ; preds = %bb4
br i1 undef, label %bb2, label %bb8
bb8: ; preds = %bb6
br i1 true, label %bb4, label %bb3
}
define void @test_many_subloops(i1 %c) {
; CHECK-LABEL: @test_many_subloops(
; CHECK-NEXT: br label [[BB1:%.*]]
; CHECK: bb1.loopexit:
; CHECK-NEXT: br label [[BB1]]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb2.loopexit:
; CHECK-NEXT: br label [[BB2]]
; CHECK: bb2:
; CHECK-NEXT: switch i32 0, label [[BB2_SPLIT:%.*]] [
; CHECK-NEXT: i32 1, label [[BB1_LOOPEXIT:%.*]]
; CHECK-NEXT: i32 2, label [[BB2_LOOPEXIT:%.*]]
; CHECK-NEXT: ]
; CHECK: bb2.split:
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
; CHECK-NEXT: br label [[BB3]]
;
br label %bb1
bb1:
br label %bb2
bb2:
br label %bb3
bb3:
br i1 false, label %bb4, label %bb3
bb4:
br i1 undef, label %bb1, label %subloop1
subloop1:
br i1 %c, label %subloop2, label %subloop11
subloop11:
br i1 %c, label %subloop11, label %subloop12
subloop12:
br i1 %c, label %subloop12, label %subloop13
subloop13:
br i1 %c, label %subloop13, label %subloop1_latch
subloop1_latch:
br label %subloop1
subloop2:
br i1 %c, label %bb6, label %subloop21
subloop21:
br i1 %c, label %subloop21, label %subloop22
subloop22:
br i1 %c, label %subloop22, label %subloop23
subloop23:
br i1 %c, label %subloop23, label %subloop2_latch
subloop2_latch:
br label %subloop2
bb6:
br i1 undef, label %bb2, label %bb8
bb8:
br i1 true, label %bb4, label %bb3
}
|