1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
5 ; Fix for PR33641. ArgumentPromotion removed the argument to bar but left the call to
6 ; dbg.value which still used the removed argument.
8 ; The %p argument should be removed, and the use of it in dbg.value should be
15 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
16 ; CHECK-LABEL: define {{[^@]+}}@foo
17 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
18 ; CHECK-NEXT: [[TMP:%.*]] = alloca ptr, align 8
19 ; CHECK-NEXT: ret void
22 store %fun_t @bar, ptr %tmp
26 define internal void @bar(%p_t %p) {
27 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
28 ; CGSCC-LABEL: define {{[^@]+}}@bar
29 ; CGSCC-SAME: (ptr nocapture nofree readnone [[P:%.*]]) #[[ATTR0]] {
30 ; CGSCC-NEXT: call void @llvm.dbg.value(metadata ptr [[P]], metadata [[META3:![0-9]+]], metadata !DIExpression()) #[[ATTR2:[0-9]+]], !dbg [[DBG5:![0-9]+]]
31 ; CGSCC-NEXT: ret void
33 call void @llvm.dbg.value(metadata %p_t %p, metadata !4, metadata !5), !dbg !6
37 declare void @llvm.dbg.value(metadata, metadata, metadata)
40 !llvm.module.flags = !{!2}
42 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1)
43 !1 = !DIFile(filename: "test.c", directory: "")
44 !2 = !{i32 2, !"Debug Info Version", i32 3}
45 !3 = distinct !DISubprogram(name: "bar", unit: !0)
46 !4 = !DILocalVariable(name: "p", scope: !3)
48 !6 = !DILocation(line: 1, column: 1, scope: !3)
50 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
51 ; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
53 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
54 ; CGSCC: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
55 ; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }
57 ; TUNIT: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
58 ; TUNIT: [[META1:![0-9]+]] = !DIFile(filename: "test.c", directory: "")
59 ; TUNIT: [[META2:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
61 ; CGSCC: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
62 ; CGSCC: [[META1:![0-9]+]] = !DIFile(filename: "test.c", directory: "")
63 ; CGSCC: [[META2:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
64 ; CGSCC: [[META3]] = !DILocalVariable(name: "p", scope: !4)
65 ; CGSCC: [[META4:![0-9]+]] = distinct !DISubprogram(name: "bar", scope: null, spFlags: DISPFlagDefinition, unit: !0)
66 ; CGSCC: [[DBG5]] = !DILocation(line: 1, column: 1, scope: !4)
68 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: