1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
6
7@G = internal global i32 undef, align 4, !dbg !0
8
9;.
10; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 undef, align 4, !dbg [[DBG0:![0-9]+]]
11;.
12define void @dest() !dbg !15 {
13; IS__TUNIT____-LABEL: define {{[^@]+}}@dest
14; IS__TUNIT____-SAME: () !dbg [[DBG15:![0-9]+]] {
15; IS__TUNIT____-NEXT:  entry:
16; IS__TUNIT____-NEXT:    [[TMP0:%.*]] = call i32 @speculatable()
17; IS__TUNIT____-NEXT:    [[TMP1:%.*]] = add i32 [[TMP0]], 1
18; IS__TUNIT____-NEXT:    call void @use(i32 noundef [[TMP1]]), !dbg [[DBG19:![0-9]+]]
19; IS__TUNIT____-NEXT:    ret void, !dbg [[DBG20:![0-9]+]]
20;
21; IS__CGSCC____-LABEL: define {{[^@]+}}@dest
22; IS__CGSCC____-SAME: () !dbg [[DBG15:![0-9]+]] {
23; IS__CGSCC____-NEXT:  entry:
24; IS__CGSCC____-NEXT:    [[TMP0:%.*]] = load i32, ptr @G, align 4, !dbg [[DBG19:![0-9]+]]
25; IS__CGSCC____-NEXT:    call void @use(i32 noundef [[TMP0]]), !dbg [[DBG20:![0-9]+]]
26; IS__CGSCC____-NEXT:    ret void, !dbg [[DBG21:![0-9]+]]
27;
28entry:
29  %0 = load i32, ptr @G, align 4, !dbg !19
30  call void @use(i32 noundef %0), !dbg !20
31  ret void, !dbg !21
32}
33
34declare void @use(i32 noundef)
35
36define void @src() norecurse !dbg !22 {
37; IS__TUNIT____: Function Attrs: norecurse nosync writeonly
38; IS__TUNIT____-LABEL: define {{[^@]+}}@src
39; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] !dbg [[DBG21:![0-9]+]] {
40; IS__TUNIT____-NEXT:  entry:
41; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i32 @speculatable(), !dbg [[DBG22:![0-9]+]]
42; IS__TUNIT____-NEXT:    [[PLUS1:%.*]] = add i32 [[CALL]], 1
43; IS__TUNIT____-NEXT:    store i32 [[PLUS1]], ptr @G, align 4, !dbg [[DBG23:![0-9]+]]
44; IS__TUNIT____-NEXT:    ret void, !dbg [[DBG24:![0-9]+]]
45;
46; IS__CGSCC____: Function Attrs: norecurse nosync writeonly
47; IS__CGSCC____-LABEL: define {{[^@]+}}@src
48; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] !dbg [[DBG22:![0-9]+]] {
49; IS__CGSCC____-NEXT:  entry:
50; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i32 @speculatable(), !dbg [[DBG23:![0-9]+]]
51; IS__CGSCC____-NEXT:    [[PLUS1:%.*]] = add i32 [[CALL]], 1
52; IS__CGSCC____-NEXT:    store i32 [[PLUS1]], ptr @G, align 4, !dbg [[DBG24:![0-9]+]]
53; IS__CGSCC____-NEXT:    ret void, !dbg [[DBG25:![0-9]+]]
54;
55entry:
56  %call = call i32 @speculatable(), !dbg !23
57  %plus1 = add i32 %call, 1
58  store i32 %plus1, ptr @G, align 4, !dbg !24
59  ret void, !dbg !25
60}
61
62declare i32 @speculatable() speculatable readnone
63
64!llvm.dbg.cu = !{!2}
65!llvm.module.flags = !{!7, !8, !9, !10, !11, !12, !13}
66!llvm.ident = !{!14}
67
68!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
69!1 = distinct !DIGlobalVariable(name: "G", scope: !2, file: !5, line: 1, type: !6, isLocal: true, isDefinition: true)
70!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
71!3 = !DIFile(filename: "/app/example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970")
72!4 = !{!0}
73!5 = !DIFile(filename: "example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970")
74!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
75!7 = !{i32 7, !"Dwarf Version", i32 5}
76!8 = !{i32 2, !"Debug Info Version", i32 3}
77!9 = !{i32 1, !"wchar_size", i32 4}
78!10 = !{i32 7, !"PIC Level", i32 2}
79!11 = !{i32 7, !"PIE Level", i32 2}
80!12 = !{i32 7, !"uwtable", i32 2}
81!13 = !{i32 7, !"frame-pointer", i32 2}
82!14 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)"}
83!15 = distinct !DISubprogram(name: "dest", scope: !5, file: !5, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
84!16 = !DISubroutineType(types: !17)
85!17 = !{null}
86!18 = !{}
87!19 = !DILocation(line: 5, column: 9, scope: !15)
88!20 = !DILocation(line: 5, column: 5, scope: !15)
89!21 = !DILocation(line: 6, column: 1, scope: !15)
90!22 = distinct !DISubprogram(name: "src", scope: !5, file: !5, line: 9, type: !16, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
91!23 = !DILocation(line: 10, column: 9, scope: !22)
92!24 = !DILocation(line: 10, column: 7, scope: !22)
93!25 = !DILocation(line: 11, column: 1, scope: !22)
94;.
95; CHECK: attributes #[[ATTR0:[0-9]+]] = { norecurse nosync writeonly }
96; CHECK: attributes #[[ATTR1:[0-9]+]] = { readnone speculatable }
97;.
98; IS__TUNIT____: [[DBG0]] = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
99; IS__TUNIT____: [[META1:![0-9]+]] = distinct !DIGlobalVariable(name: "G", scope: !2, file: !5, line: 1, type: !6, isLocal: true, isDefinition: true)
100; IS__TUNIT____: [[META2:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
101; IS__TUNIT____: [[META3:![0-9]+]] = !DIFile(filename: "/app/example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970")
102; IS__TUNIT____: [[META4:![0-9]+]] = !{!0}
103; IS__TUNIT____: [[META5:![0-9]+]] = !DIFile(filename: "example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970")
104; IS__TUNIT____: [[META6:![0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
105; IS__TUNIT____: [[META7:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 5}
106; IS__TUNIT____: [[META8:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
107; IS__TUNIT____: [[META9:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
108; IS__TUNIT____: [[META10:![0-9]+]] = !{i32 7, !"PIC Level", i32 2}
109; IS__TUNIT____: [[META11:![0-9]+]] = !{i32 7, !"PIE Level", i32 2}
110; IS__TUNIT____: [[META12:![0-9]+]] = !{i32 7, !"uwtable", i32 2}
111; IS__TUNIT____: [[META13:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}
112; IS__TUNIT____: [[META14:![0-9]+]] = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)"}
113; IS__TUNIT____: [[DBG15]] = distinct !DISubprogram(name: "dest", scope: !5, file: !5, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
114; IS__TUNIT____: [[META16:![0-9]+]] = !DISubroutineType(types: !17)
115; IS__TUNIT____: [[META17:![0-9]+]] = !{null}
116; IS__TUNIT____: [[META18:![0-9]+]] = !{}
117; IS__TUNIT____: [[DBG19]] = !DILocation(line: 5, column: 5, scope: !15)
118; IS__TUNIT____: [[DBG20]] = !DILocation(line: 6, column: 1, scope: !15)
119; IS__TUNIT____: [[DBG21]] = distinct !DISubprogram(name: "src", scope: !5, file: !5, line: 9, type: !16, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
120; IS__TUNIT____: [[DBG22]] = !DILocation(line: 10, column: 9, scope: !21)
121; IS__TUNIT____: [[DBG23]] = !DILocation(line: 10, column: 7, scope: !21)
122; IS__TUNIT____: [[DBG24]] = !DILocation(line: 11, column: 1, scope: !21)
123;.
124; IS__CGSCC____: [[DBG0]] = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
125; IS__CGSCC____: [[META1:![0-9]+]] = distinct !DIGlobalVariable(name: "G", scope: !2, file: !5, line: 1, type: !6, isLocal: true, isDefinition: true)
126; IS__CGSCC____: [[META2:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
127; IS__CGSCC____: [[META3:![0-9]+]] = !DIFile(filename: "/app/example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970")
128; IS__CGSCC____: [[META4:![0-9]+]] = !{!0}
129; IS__CGSCC____: [[META5:![0-9]+]] = !DIFile(filename: "example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970")
130; IS__CGSCC____: [[META6:![0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
131; IS__CGSCC____: [[META7:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 5}
132; IS__CGSCC____: [[META8:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
133; IS__CGSCC____: [[META9:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
134; IS__CGSCC____: [[META10:![0-9]+]] = !{i32 7, !"PIC Level", i32 2}
135; IS__CGSCC____: [[META11:![0-9]+]] = !{i32 7, !"PIE Level", i32 2}
136; IS__CGSCC____: [[META12:![0-9]+]] = !{i32 7, !"uwtable", i32 2}
137; IS__CGSCC____: [[META13:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}
138; IS__CGSCC____: [[META14:![0-9]+]] = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)"}
139; IS__CGSCC____: [[DBG15]] = distinct !DISubprogram(name: "dest", scope: !5, file: !5, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
140; IS__CGSCC____: [[META16:![0-9]+]] = !DISubroutineType(types: !17)
141; IS__CGSCC____: [[META17:![0-9]+]] = !{null}
142; IS__CGSCC____: [[META18:![0-9]+]] = !{}
143; IS__CGSCC____: [[DBG19]] = !DILocation(line: 5, column: 9, scope: !15)
144; IS__CGSCC____: [[DBG20]] = !DILocation(line: 5, column: 5, scope: !15)
145; IS__CGSCC____: [[DBG21]] = !DILocation(line: 6, column: 1, scope: !15)
146; IS__CGSCC____: [[DBG22]] = distinct !DISubprogram(name: "src", scope: !5, file: !5, line: 9, type: !16, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
147; IS__CGSCC____: [[DBG23]] = !DILocation(line: 10, column: 9, scope: !22)
148; IS__CGSCC____: [[DBG24]] = !DILocation(line: 10, column: 7, scope: !22)
149; IS__CGSCC____: [[DBG25]] = !DILocation(line: 11, column: 1, scope: !22)
150;.
151