1 ; RUN: opt < %s -passes='print<func-properties>' -disable-output 2>&1 | FileCheck %s
2 ; RUN: opt < %s -passes='print<func-properties>' -disable-output 2>&1 -enable-detailed-function-properties | FileCheck %s --check-prefix=DETAILED-PROPERTIES
5 ; CHECK-DAG: Printing analysis results of CFA for function 'main':
6 ; DETAILED-PROPERTIES-DAG: Printing analysis results of CFA for function 'main':
9 %retval = alloca i32, align 4
10 %mat1 = alloca [2 x [2 x i32]], align 16
11 %mat2 = alloca [2 x [2 x i32]], align 16
12 %res = alloca [2 x [2 x i32]], align 16
13 %i = alloca i32, align 4
14 %j = alloca i32, align 4
15 store i32 0, ptr %retval, align 4
16 %arraydecay = getelementptr inbounds [2 x [2 x i32]], ptr %mat1, i64 0, i64 0
17 %arraydecay1 = getelementptr inbounds [2 x [2 x i32]], ptr %mat2, i64 0, i64 0
18 %arraydecay2 = getelementptr inbounds [2 x [2 x i32]], ptr %res, i64 0, i64 0
19 call void @multiply(ptr %arraydecay, ptr %arraydecay1, ptr %arraydecay2)
22 ; CHECK-DAG: BasicBlockCount: 1
23 ; CHECK-DAG: BlocksReachedFromConditionalInstruction: 0
25 ; CHECK-DAG: DirectCallsToDefinedFunctions: 1
26 ; CHECK-DAG: LoadInstCount: 0
27 ; CHECK-DAG: StoreInstCount: 1
28 ; CHECK-DAG: MaxLoopDepth: 0
29 ; CHECK-DAG: TopLevelLoopCount: 0
31 ; DETAILED-PROPERTIES-DAG: BasicBlockCount: 1
32 ; DETAILED-PROPERTIES-DAG: BlocksReachedFromConditionalInstruction: 0
33 ; DETAILED-PROPERTIES-DAG: Uses: 1
34 ; DETAILED-PROPERTIES-DAG: DirectCallsToDefinedFunctions: 1
35 ; DETAILED-PROPERTIES-DAG: LoadInstCount: 0
36 ; DETAILED-PROPERTIES-DAG: StoreInstCount: 1
37 ; DETAILED-PROPERTIES-DAG: MaxLoopDepth: 0
38 ; DETAILED-PROPERTIES-DAG: TopLevelLoopCount: 0
39 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithSingleSuccessor: 0
40 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithTwoSuccessors: 0
41 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithMoreThanTwoSuccessors: 0
42 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithSinglePredecessor: 0
43 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithTwoPredecessors: 0
44 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithMoreThanTwoPredecessors: 0
45 ; DETAILED-PROPERTIES-DAG: BigBasicBlocks: 0
46 ; DETAILED-PROPERTIES-DAG: MediumBasicBlocks: 0
47 ; DETAILED-PROPERTIES-DAG: SmallBasicBlocks: 1
48 ; DETAILED-PROPERTIES-DAG: CastInstructionCount: 0
49 ; DETAILED-PROPERTIES-DAG: FloatingPointInstructionCount: 0
50 ; DETAILED-PROPERTIES-DAG: IntegerInstructionCount: 0
51 ; DETAILED-PROPERTIES-DAG: ConstantIntOperandCount: 14
52 ; DETAILED-PROPERTIES-DAG: ConstantFPOperandCount: 0
53 ; DETAILED-PROPERTIES-DAG: ConstantOperandCount: 0
54 ; DETAILED-PROPERTIES-DAG: InstructionOperandCount: 7
55 ; DETAILED-PROPERTIES-DAG: BasicBlockOperandCount: 0
56 ; DETAILED-PROPERTIES-DAG: GlobalValueOperandCount: 1
57 ; DETAILED-PROPERTIES-DAG: InlineAsmOperandCount: 0
58 ; DETAILED-PROPERTIES-DAG: ArgumentOperandCount: 0
59 ; DETAILED-PROPERTIES-DAG: UnknownOperandCount: 0
60 ; DETAILED-PROPERTIES-DAG: CriticalEdgeCount: 0
61 ; DETAILED-PROPERTIES-DAG: ControlFlowEdgeCount: 0
62 ; DETAILED-PROPERTIES-DAG: UnconditionalBranchCount: 0
63 ; DETAILED-PROPERTIES-DAG: DirectCallCount: 1
64 ; DETAILED-PROPERTIES-DAG: IndirectCallCount: 0
65 ; DETAILED-PROPERTIES-DAG: CallReturnsIntegerCount: 0
66 ; DETAILED-PROPERTIES-DAG: CallReturnsFloatCount: 0
67 ; DETAILED-PROPERTIES-DAG: CallReturnsPointerCount: 0
68 ; DETAILED-PROPERTIES-DAG: CallReturnsVectorIntCount: 0
69 ; DETAILED-PROPERTIES-DAG: CallReturnsVectorFloatCount: 0
70 ; DETAILED-PROPERTIES-DAG: CallReturnsVectorPointerCount: 0
71 ; DETAILED-PROPERTIES-DAG: CallWithManyArgumentsCount: 0
72 ; DETAILED-PROPERTIES-DAG: CallWithPointerArgumentCount: 1
74 define void @multiply(ptr %mat1, ptr %mat2, ptr %res) {
75 ; CHECK-DAG: Printing analysis results of CFA for function 'multiply':
76 ; DETAILED-PROPERTIES-DAG: Printing analysis results of CFA for function 'multiply':
78 %mat1.addr = alloca ptr, align 8
79 %mat2.addr = alloca ptr, align 8
80 %res.addr = alloca ptr, align 8
81 %i = alloca i32, align 4
82 %j = alloca i32, align 4
83 %k = alloca i32, align 4
84 store ptr %mat1, ptr %mat1.addr, align 8
85 store ptr %mat2, ptr %mat2.addr, align 8
86 store ptr %res, ptr %res.addr, align 8
87 store i32 0, ptr %i, align 4
90 for.cond: ; preds = %for.inc24, %entry
91 %0 = load i32, ptr %i, align 4
92 %cmp = icmp slt i32 %0, 2
93 br i1 %cmp, label %for.body, label %for.end26
95 for.body: ; preds = %for.cond
96 store i32 0, ptr %j, align 4
99 for.cond1: ; preds = %for.inc21, %for.body
100 %1 = load i32, ptr %j, align 4
101 %cmp2 = icmp slt i32 %1, 2
102 br i1 %cmp2, label %for.body3, label %for.end23
104 for.body3: ; preds = %for.cond1
105 %2 = load ptr, ptr %res.addr, align 8
106 %3 = load i32, ptr %i, align 4
107 %idxprom = sext i32 %3 to i64
108 %arrayidx = getelementptr inbounds [2 x i32], ptr %2, i64 %idxprom
109 %4 = load i32, ptr %j, align 4
110 %idxprom4 = sext i32 %4 to i64
111 %arrayidx5 = getelementptr inbounds [2 x i32], ptr %arrayidx, i64 0, i64 %idxprom4
112 store i32 0, ptr %arrayidx5, align 4
113 store i32 0, ptr %k, align 4
116 for.cond6: ; preds = %for.inc, %for.body3
117 %5 = load i32, ptr %k, align 4
118 %cmp7 = icmp slt i32 %5, 2
119 br i1 %cmp7, label %for.body8, label %for.end
121 for.body8: ; preds = %for.cond6
122 %6 = load ptr, ptr %mat1.addr, align 8
123 %7 = load i32, ptr %i, align 4
124 %idxprom9 = sext i32 %7 to i64
125 %arrayidx10 = getelementptr inbounds [2 x i32], ptr %6, i64 %idxprom9
126 %8 = load i32, ptr %k, align 4
127 %idxprom11 = sext i32 %8 to i64
128 %arrayidx12 = getelementptr inbounds [2 x i32], ptr %arrayidx10, i64 0, i64 %idxprom11
129 %9 = load i32, ptr %arrayidx12, align 4
130 %10 = load ptr, ptr %mat2.addr, align 8
131 %11 = load i32, ptr %k, align 4
132 %idxprom13 = sext i32 %11 to i64
133 %arrayidx14 = getelementptr inbounds [2 x i32], ptr %10, i64 %idxprom13
134 %12 = load i32, ptr %j, align 4
135 %idxprom15 = sext i32 %12 to i64
136 %arrayidx16 = getelementptr inbounds [2 x i32], ptr %arrayidx14, i64 0, i64 %idxprom15
137 %13 = load i32, ptr %arrayidx16, align 4
138 %mul = mul nsw i32 %9, %13
139 %14 = load ptr, ptr %res.addr, align 8
140 %15 = load i32, ptr %i, align 4
141 %idxprom17 = sext i32 %15 to i64
142 %arrayidx18 = getelementptr inbounds [2 x i32], ptr %14, i64 %idxprom17
143 %16 = load i32, ptr %j, align 4
144 %idxprom19 = sext i32 %16 to i64
145 %arrayidx20 = getelementptr inbounds [2 x i32], ptr %arrayidx18, i64 0, i64 %idxprom19
146 %17 = load i32, ptr %arrayidx20, align 4
147 %add = add nsw i32 %17, %mul
148 store i32 %add, ptr %arrayidx20, align 4
151 for.inc: ; preds = %for.body8
152 %18 = load i32, ptr %k, align 4
153 %inc = add nsw i32 %18, 1
154 store i32 %inc, ptr %k, align 4
157 for.end: ; preds = %for.cond6
160 for.inc21: ; preds = %for.end
161 %19 = load i32, ptr %j, align 4
162 %inc22 = add nsw i32 %19, 1
163 store i32 %inc22, ptr %j, align 4
166 for.end23: ; preds = %for.cond1
169 for.inc24: ; preds = %for.end23
170 %20 = load i32, ptr %i, align 4
171 %inc25 = add nsw i32 %20, 1
172 store i32 %inc25, ptr %i, align 4
175 for.end26: ; preds = %for.cond
179 ; CHECK-DAG: BasicBlockCount: 13
180 ; CHECK-DAG: BlocksReachedFromConditionalInstruction: 6
182 ; CHECK-DAG: DirectCallsToDefinedFunctions: 0
183 ; CHECK-DAG: LoadInstCount: 21
184 ; CHECK-DAG: StoreInstCount: 11
185 ; CHECK-DAG: MaxLoopDepth: 3
186 ; CHECK-DAG: TopLevelLoopCount: 1
188 ; DETAILED-PROPERTIES-DAG: BasicBlockCount: 13
189 ; DETAILED-PROPERTIES-DAG: BlocksReachedFromConditionalInstruction: 6
190 ; DETAILED-PROPERTIES-DAG: Uses: 2
191 ; DETAILED-PROPERTIES-DAG: DirectCallsToDefinedFunctions: 0
192 ; DETAILED-PROPERTIES-DAG: LoadInstCount: 21
193 ; DETAILED-PROPERTIES-DAG: StoreInstCount: 11
194 ; DETAILED-PROPERTIES-DAG: MaxLoopDepth: 3
195 ; DETAILED-PROPERTIES-DAG: TopLevelLoopCount: 1
196 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithSingleSuccessor: 9
197 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithTwoSuccessors: 3
198 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithMoreThanTwoSuccessors: 0
199 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithSinglePredecessor: 9
200 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithTwoPredecessors: 3
201 ; DETAILED-PROPERTIES-DAG: BasicBlocksWithMoreThanTwoPredecessors: 0
202 ; DETAILED-PROPERTIES-DAG: BigBasicBlocks: 0
203 ; DETAILED-PROPERTIES-DAG: MediumBasicBlocks: 11
204 ; DETAILED-PROPERTIES-DAG: SmallBasicBlocks: 2
205 ; DETAILED-PROPERTIES-DAG: CastInstructionCount: 8
206 ; DETAILED-PROPERTIES-DAG: FloatingPointInstructionCount: 0
207 ; DETAILED-PROPERTIES-DAG: IntegerInstructionCount: 33
208 ; DETAILED-PROPERTIES-DAG: ConstantIntOperandCount: 20
209 ; DETAILED-PROPERTIES-DAG: ConstantFPOperandCount: 0
210 ; DETAILED-PROPERTIES-DAG: ConstantOperandCount: 0
211 ; DETAILED-PROPERTIES-DAG: InstructionOperandCount: 73
212 ; DETAILED-PROPERTIES-DAG: BasicBlockOperandCount: 15
213 ; DETAILED-PROPERTIES-DAG: GlobalValueOperandCount: 0
214 ; DETAILED-PROPERTIES-DAG: InlineAsmOperandCount: 0
215 ; DETAILED-PROPERTIES-DAG: ArgumentOperandCount: 3
216 ; DETAILED-PROPERTIES-DAG: UnknownOperandCount: 0
217 ; DETAILED-PROPERTIES-DAG: DirectCallCount: 0
218 ; DETAILED-PROPERTIES-DAG: IndirectCallCount: 0
219 ; DETAILED-PROPERTIES-DAG: CriticalEdgeCount: 0
220 ; DETAILED-PROPERTIES-DAG: ControlFlowEdgeCount: 15
221 ; DETAILED-PROPERTIES-DAG: UnconditionalBranchCount: 9
222 ; DETAILED-PROPERTIES-DAG: CallReturnsIntegerCount: 0
223 ; DETAILED-PROPERTIES-DAG: CallReturnsFloatCount: 0
224 ; DETAILED-PROPERTIES-DAG: CallReturnsPointerCount: 0
225 ; DETAILED-PROPERTIES-DAG: CallReturnsVectorIntCount: 0
226 ; DETAILED-PROPERTIES-DAG: CallReturnsVectorFloatCount: 0
227 ; DETAILED-PROPERTIES-DAG: CallReturnsVectorPointerCount: 0
228 ; DETAILED-PROPERTIES-DAG: CallWithManyArgumentsCount: 0
229 ; DETAILED-PROPERTIES-DAG: CallWithPointerArgumentCount: 0