1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=debug.DumpDominators \
3 // RUN: -analyzer-checker=debug.DumpPostDominators \
4 // RUN: -analyzer-checker=debug.DumpControlDependencies \
5 // RUN: 2>&1 | FileCheck %s
7 // Test the DominatorsTree implementation with various control flows
29 // [B9 (ENTRY)] -> [B8] -> [B7] -> [B6] -> [B5] -> [B3] -> [B2]
31 // | \ ---> [B4] ---> /
32 // | <---------------------------
34 // [B1] -> [B0 (EXIT)]
36 // CHECK: Control dependencies (Node#,Dependency#):
45 // CHECK-NEXT: Immediate dominance tree (Node#,IDom#):
56 // CHECK-NEXT: Immediate post dominance tree (Node#,IDom#):
88 // -----------> [B4] -> [B3] -> [B2]
91 // [B7 (ENTRY)] -> [B6] -> [B5] -> [B1] -> [B0 (EXIT)]
93 // CHECK: Control dependencies (Node#,Dependency#):
101 // CHECK-NEXT: Immediate dominance tree (Node#,IDom#):
110 // CHECK-NEXT: Immediate post dominance tree (Node#,IDom#):
140 // [B8 (ENTRY)] -> [B7] -> [B6] ---> [B5] -> [B4] -> [B3]
142 // \ | <-------------
144 // --------> [B1] -> [B0 (EXIT)]
146 // CHECK: Control dependencies (Node#,Dependency#):
160 // CHECK-NEXT: Immediate dominance tree (Node#,IDom#):
170 // CHECK-NEXT: Immediate post dominance tree (Node#,IDom#):
196 // <----------------------------------
197 // / <----------------- \
199 // [B12 (ENTRY)] -> [B11] -> [B10]-> [B9] -> [B8] ---> [B7] -> [B6] |
201 // | \ -----> [B2] --------/
203 // | -> [B5] -> [B4] -> [B3]
207 // -> [B1] -> [B0 (EXIT)]
209 // CHECK: Control dependencies (Node#,Dependency#):
210 // CHECK-NEXT: (2,10)
213 // CHECK-NEXT: (3,10)
216 // CHECK-NEXT: (4,10)
219 // CHECK-NEXT: (5,10)
222 // CHECK-NEXT: (6,10)
225 // CHECK-NEXT: (7,10)
228 // CHECK-NEXT: (8,10)
229 // CHECK-NEXT: (9,10)
230 // CHECK-NEXT: (10,10)
231 // CHECK-NEXT: Immediate dominance tree (Node#,IDom#):
233 // CHECK-NEXT: (1,10)
241 // CHECK-NEXT: (9,10)
242 // CHECK-NEXT: (10,11)
243 // CHECK-NEXT: (11,12)
244 // CHECK-NEXT: (12,12)
245 // CHECK-NEXT: Immediate post dominance tree (Node#,IDom#):
248 // CHECK-NEXT: (2,10)
256 // CHECK-NEXT: (10,1)
257 // CHECK-NEXT: (11,10)
258 // CHECK-NEXT: (12,11)
290 // [B11 (ENTY)] -> [B10] -> [B9] -> [B8] -> [B7] -> [B5] -> [B3] -> [B1]
294 // V [B4] -----------------> /
295 // [B2]--------------------------------->
297 // CHECK: Control dependencies (Node#,Dependency#):
298 // CHECK-NEXT: (2,10)
299 // CHECK-NEXT: (3,10)
301 // CHECK-NEXT: (4,10)
303 // CHECK-NEXT: (5,10)
306 // CHECK-NEXT: (6,10)
309 // CHECK-NEXT: (7,10)
311 // CHECK-NEXT: (8,10)
312 // CHECK-NEXT: (9,10)
313 // CHECK-NEXT: Immediate dominance tree (Node#,IDom#):
315 // CHECK-NEXT: (1,10)
316 // CHECK-NEXT: (2,10)
323 // CHECK-NEXT: (9,10)
324 // CHECK-NEXT: (10,11)
325 // CHECK-NEXT: (11,11)
326 // CHECK-NEXT: Immediate post dominance tree (Node#,IDom#):
337 // CHECK-NEXT: (10,1)
338 // CHECK-NEXT: (11,10)