[ValueTracking] test trunc to i1 as condition in dominating condition. (NFC)
[llvm-project.git] / llvm / test / Analysis / KernelInfo / calls.ll
blob6a2a5c426b78b6b2056c421bdd61cf4870212b85
1 ; Check info on calls.
3 ; RUN: opt -pass-remarks=kernel-info -passes=kernel-info \
4 ; RUN:     -disable-output %s 2>&1 | \
5 ; RUN:   FileCheck -match-full-lines %s
7 target datalayout = "e-i65:64-i128:128-v16:16-v32:32-n16:32:64"
8 target triple = "nvptx64-nvidia-cuda"
10 declare void @personality()
12 define void @h() personality ptr @personality !dbg !100 {
13 entry:
14   ; CHECK: remark: test.c:16:5: in artificial function 'h_dbg', direct call, callee is '@f'
15   call void @f(), !dbg !102
16   ; CHECK: remark: test.c:17:5: in artificial function 'h_dbg', direct call to defined function, callee is 'g_dbg'
17   call void @g(), !dbg !104
18   ; CHECK: remark: test.c:18:5: in artificial function 'h_dbg', direct call to defined function, callee is artificial 'h_dbg'
19   call void @h(), !dbg !105
20   ; CHECK: remark: test.c:24:5: in artificial function 'h_dbg', direct call to inline assembly, callee is 'asm sideeffect "eieio", ""'
21   call void asm sideeffect "eieio", ""(), !dbg !111
22   %fnPtr = load ptr, ptr null, align 8
23   ; CHECK: remark: test.c:19:5: in artificial function 'h_dbg', indirect call, callee is '%fnPtr'
24   call void %fnPtr(), !dbg !106
25   ; CHECK: remark: test.c:20:5: in artificial function 'h_dbg', direct invoke, callee is '@f'
26   invoke void @f() to label %fcont unwind label %cleanup, !dbg !107
27 fcont:
28   ; CHECK: remark: test.c:21:5: in artificial function 'h_dbg', direct invoke to defined function, callee is 'g_dbg'
29   invoke void @g() to label %gcont unwind label %cleanup, !dbg !108
30 gcont:
31   ; CHECK: remark: test.c:22:5: in artificial function 'h_dbg', direct invoke to defined function, callee is artificial 'h_dbg'
32   invoke void @h() to label %hcont unwind label %cleanup, !dbg !109
33 hcont:
34   ; CHECK: remark: test.c:25:5: in artificial function 'h_dbg', direct invoke to inline assembly, callee is 'asm sideeffect "eieio", ""'
35   invoke void asm sideeffect "eieio", ""() to label %asmcont unwind label %cleanup, !dbg !112
36 asmcont:
37   ; CHECK: remark: test.c:23:5: in artificial function 'h_dbg', indirect invoke, callee is '%fnPtr'
38   invoke void %fnPtr() to label %end unwind label %cleanup, !dbg !110
39 cleanup:
40   %ll = landingpad { ptr, i32 }
41   cleanup
42   br label %end
43 end:
44   ret void
46 ; CHECK: remark: test.c:13:0: in artificial function 'h_dbg', DirectCalls = 8
47 ; CHECK: remark: test.c:13:0: in artificial function 'h_dbg', IndirectCalls = 2
48 ; CHECK: remark: test.c:13:0: in artificial function 'h_dbg', DirectCallsToDefinedFunctions = 4
49 ; CHECK: remark: test.c:13:0: in artificial function 'h_dbg', InlineAssemblyCalls = 2
50 ; CHECK: remark: test.c:13:0: in artificial function 'h_dbg', Invokes = 5
52 declare void @f()
54 define void @g() personality ptr @personality !dbg !200 {
55 entry:
56   ; CHECK: remark: test.c:6:3: in function 'g_dbg', direct call, callee is '@f'
57   call void @f(), !dbg !202
58   ; CHECK: remark: test.c:7:3: in function 'g_dbg', direct call to defined function, callee is 'g_dbg'
59   call void @g(), !dbg !203
60   ; CHECK: remark: test.c:8:3: in function 'g_dbg', direct call to defined function, callee is artificial 'h_dbg'
61   call void @h(), !dbg !204
62   ; CHECK: remark: test.c:14:3: in function 'g_dbg', direct call to inline assembly, callee is 'asm sideeffect "eieio", ""'
63   call void asm sideeffect "eieio", ""(), !dbg !210
64   %fnPtr = load ptr, ptr null, align 8
65   ; CHECK: remark: test.c:9:3: in function 'g_dbg', indirect call, callee is '%fnPtr'
66   call void %fnPtr(), !dbg !205
67   ; CHECK: remark: test.c:10:3: in function 'g_dbg', direct invoke, callee is '@f'
68   invoke void @f() to label %fcont unwind label %cleanup, !dbg !206
69 fcont:
70   ; CHECK: remark: test.c:11:3: in function 'g_dbg', direct invoke to defined function, callee is 'g_dbg'
71   invoke void @g() to label %gcont unwind label %cleanup, !dbg !207
72 gcont:
73   ; CHECK: remark: test.c:12:3: in function 'g_dbg', direct invoke to defined function, callee is artificial 'h_dbg'
74   invoke void @h() to label %hcont unwind label %cleanup, !dbg !208
75 hcont:
76   ; CHECK: remark: test.c:15:3: in function 'g_dbg', direct invoke to inline assembly, callee is 'asm sideeffect "eieio", ""'
77   invoke void asm sideeffect "eieio", ""() to label %asmcont unwind label %cleanup, !dbg !211
78 asmcont:
79   ; CHECK: remark: test.c:13:3: in function 'g_dbg', indirect invoke, callee is '%fnPtr'
80   invoke void %fnPtr() to label %end unwind label %cleanup, !dbg !209
81 cleanup:
82   %ll = landingpad { ptr, i32 }
83   cleanup
84   br label %end
85 end:
86   ret void
88 ; CHECK: remark: test.c:3:0: in function 'g_dbg', DirectCalls = 8
89 ; CHECK: remark: test.c:3:0: in function 'g_dbg', IndirectCalls = 2
90 ; CHECK: remark: test.c:3:0: in function 'g_dbg', DirectCallsToDefinedFunctions = 4
91 ; CHECK: remark: test.c:3:0: in function 'g_dbg', InlineAssemblyCalls = 2
92 ; CHECK: remark: test.c:3:0: in function 'g_dbg', Invokes = 5
94 define void @i() {
95   ; CHECK: remark: <unknown>:0:0: in function '@i', direct call, callee is '@f'
96   call void @f()
97   ret void
99 ; CHECK: remark: <unknown>:0:0: in function '@i', DirectCalls = 1
100 ; CHECK: remark: <unknown>:0:0: in function '@i', IndirectCalls = 0
101 ; CHECK: remark: <unknown>:0:0: in function '@i', DirectCallsToDefinedFunctions = 0
102 ; CHECK: remark: <unknown>:0:0: in function '@i', InlineAssemblyCalls = 0
103 ; CHECK: remark: <unknown>:0:0: in function '@i', Invokes = 0
105 !llvm.module.flags = !{!0}
106 !llvm.dbg.cu = !{!1}
108 !0 = !{i32 2, !"Debug Info Version", i32 3}
109 !1 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
110 !2 = !DIFile(filename: "test.c", directory: "/tmp")
111 !3 = !{null}
112 !4 = !{}
114 !100 = distinct !DISubprogram(name: "h_dbg", scope: !2, file: !2, line: 13, type: !101, scopeLine: 13, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1, retainedNodes: !4)
115 !101 = distinct !DISubroutineType(types: !3)
116 !102 = !DILocation(line: 16, column: 5, scope: !103)
117 !103 = distinct !DILexicalBlock(scope: !100, file: !2, line: 13, column: 3)
118 !104 = !DILocation(line: 17, column: 5, scope: !103)
119 !105 = !DILocation(line: 18, column: 5, scope: !103)
120 !106 = !DILocation(line: 19, column: 5, scope: !103)
121 !107 = !DILocation(line: 20, column: 5, scope: !103)
122 !108 = !DILocation(line: 21, column: 5, scope: !103)
123 !109 = !DILocation(line: 22, column: 5, scope: !103)
124 !110 = !DILocation(line: 23, column: 5, scope: !103)
125 !111 = !DILocation(line: 24, column: 5, scope: !103)
126 !112 = !DILocation(line: 25, column: 5, scope: !103)
128 !200 = distinct !DISubprogram(name: "g_dbg", scope: !2, file: !2, line: 3, type: !201, scopeLine: 3, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !4)
129 !201 = !DISubroutineType(types: !3)
130 !202 = !DILocation(line: 6, column: 3, scope: !200)
131 !203 = !DILocation(line: 7, column: 3, scope: !200)
132 !204 = !DILocation(line: 8, column: 3, scope: !200)
133 !205 = !DILocation(line: 9, column: 3, scope: !200)
134 !206 = !DILocation(line: 10, column: 3, scope: !200)
135 !207 = !DILocation(line: 11, column: 3, scope: !200)
136 !208 = !DILocation(line: 12, column: 3, scope: !200)
137 !209 = !DILocation(line: 13, column: 3, scope: !200)
138 !210 = !DILocation(line: 14, column: 3, scope: !200)
139 !211 = !DILocation(line: 15, column: 3, scope: !200)