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=1 -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=1 -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
7 ; Fix for PR33641. ArgumentPromotion removed the argument to bar but left the call to
8 ; dbg.value which still used the removed argument.
10 ; The %p argument should be removed, and the use of it in dbg.value should be
14 %fun_t = type void (%p_t)*
17 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
18 ; IS__TUNIT____-LABEL: define {{[^@]+}}@foo
19 ; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] {
20 ; IS__TUNIT____-NEXT: [[TMP:%.*]] = alloca void (i16*)*, align 8
21 ; IS__TUNIT____-NEXT: ret void
23 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
24 ; IS__CGSCC____-LABEL: define {{[^@]+}}@foo
25 ; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] {
26 ; IS__CGSCC____-NEXT: [[TMP:%.*]] = alloca void (i16*)*, align 8
27 ; IS__CGSCC____-NEXT: ret void
30 store %fun_t @bar, %fun_t* %tmp
34 define internal void @bar(%p_t %p) {
35 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@bar
36 ; IS__CGSCC_OPM-SAME: (i16* [[P:%.*]]) {
37 ; IS__CGSCC_OPM-NEXT: call void @llvm.dbg.value(metadata i16* [[P]], metadata [[META3:![0-9]+]], metadata !DIExpression()), !dbg [[DBG5:![0-9]+]]
38 ; IS__CGSCC_OPM-NEXT: ret void
40 ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
41 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@bar
42 ; IS__CGSCC_NPM-SAME: (i16* nocapture nofree readnone [[P:%.*]]) #[[ATTR1:[0-9]+]] {
43 ; IS__CGSCC_NPM-NEXT: call void @llvm.dbg.value(metadata i16* [[P]], metadata [[META3:![0-9]+]], metadata !DIExpression()) #[[ATTR3:[0-9]+]], !dbg [[DBG5:![0-9]+]]
44 ; IS__CGSCC_NPM-NEXT: ret void
46 call void @llvm.dbg.value(metadata %p_t %p, metadata !4, metadata !5), !dbg !6
50 declare void @llvm.dbg.value(metadata, metadata, metadata)
53 !llvm.module.flags = !{!2}
55 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1)
56 !1 = !DIFile(filename: "test.c", directory: "")
57 !2 = !{i32 2, !"Debug Info Version", i32 3}
58 !3 = distinct !DISubprogram(name: "bar", unit: !0)
59 !4 = !DILocalVariable(name: "p", scope: !3)
61 !6 = !DILocation(line: 1, column: 1, scope: !3)
63 ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
64 ; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone speculatable willreturn }
66 ; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
67 ; IS__CGSCC_OPM: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone speculatable willreturn }
69 ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
70 ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
71 ; IS__CGSCC_NPM: attributes #[[ATTR2:[0-9]+]] = { nofree nosync nounwind readnone speculatable willreturn }
72 ; IS__CGSCC_NPM: attributes #[[ATTR3]] = { readnone willreturn }
74 ; IS__TUNIT____: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
75 ; IS__TUNIT____: [[META1:![0-9]+]] = !DIFile(filename: "test.c", directory: "")
76 ; IS__TUNIT____: [[META2:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
78 ; IS__CGSCC____: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
79 ; IS__CGSCC____: [[META1:![0-9]+]] = !DIFile(filename: "test.c", directory: "")
80 ; IS__CGSCC____: [[META2:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
81 ; IS__CGSCC____: [[META3:![0-9]+]] = !DILocalVariable(name: "p", scope: !4)
82 ; IS__CGSCC____: [[META4:![0-9]+]] = distinct !DISubprogram(name: "bar", scope: null, spFlags: DISPFlagDefinition, unit: !0)
83 ; IS__CGSCC____: [[META5:![0-9]+]] = !DILocation(line: 1, column: 1, scope: !4)