1
; RUN: opt -disable-output -passes=print-cg %s 2>&1 | FileCheck %s
3
; Basic validation of the call graph analysis used in the new pass manager.
6
; CHECK-LABEL: Call edges in function: f
13
; A bunch more functions just to make it easier to test several call edges at once.
51
declare i32 @__gxx_personality_v0(...)
53
define void @test0() {
54
; CHECK-LABEL: Call edges in function: test0
66
define void ()* @test1(void ()** %x) personality i32 (...)* @__gxx_personality_v0 {
67
; CHECK-LABEL: Call edges in function: test1
89
phi void ()* [ @f1, %entry ], [ @f2, %dead ]
90
select i1 true, void ()* @f3, void ()* @f4
91
store void ()* @f5, void ()** %x
93
call void (void ()*, void ()*) bitcast (void ()* @f7 to void (void ()*, void ()*)*)(void ()* @f8, void ()* @f9)
94
invoke void @f10() to label %exit unwind label %unwind
100
%res = landingpad { i8*, i32 }
102
resume { i8*, i32 } { i8* bitcast (void ()* @f12 to i8*), i32 42 }
105
@g = global void ()* @f1
106
@g1 = global [4 x void ()*] [void ()* @f2, void ()* @f3, void ()* @f4, void ()* @f5]
107
@g2 = global {i8, void ()*, i8} {i8 1, void ()* @f6, i8 2}
108
@h = constant void ()* @f7
110
define void @test2() {
111
; CHECK-LABEL: Call edges in function: test2
121
load i8*, i8** bitcast (void ()** @g to i8**)
122
load i8*, i8** bitcast (void ()** getelementptr ([4 x void ()*], [4 x void ()*]* @g1, i32 0, i32 2) to i8**)
123
load i8*, i8** bitcast (void ()** getelementptr ({i8, void ()*, i8}, {i8, void ()*, i8}* @g2, i32 0, i32 1) to i8**)
124
load i8*, i8** bitcast (void ()** @h to i8**)
128
; Verify the SCCs formed.
130
; CHECK-LABEL: SCC with 1 functions:
133
; CHECK-LABEL: SCC with 1 functions:
136
; CHECK-LABEL: SCC with 1 functions:
139
; CHECK-LABEL: SCC with 1 functions:
142
; CHECK-LABEL: SCC with 1 functions:
145
; CHECK-LABEL: SCC with 1 functions:
148
; CHECK-LABEL: SCC with 1 functions:
151
; CHECK-LABEL: SCC with 1 functions:
154
; CHECK-LABEL: SCC with 1 functions:
157
; CHECK-LABEL: SCC with 1 functions:
160
; CHECK-LABEL: SCC with 1 functions:
163
; CHECK-LABEL: SCC with 1 functions:
166
; CHECK-LABEL: SCC with 1 functions:
169
; CHECK-LABEL: SCC with 1 functions:
172
; CHECK-LABEL: SCC with 1 functions:
175
; CHECK-LABEL: SCC with 1 functions: