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 4 5declare void @sink(i32) 6 7define internal void @test(ptr %X) !dbg !2 { 8; CHECK-LABEL: define {{[^@]+}}@test 9; CHECK-SAME: (ptr nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[X:%.*]]) !dbg [[DBG3:![0-9]+]] { 10; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[X]], align 8 11; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 8 12; CHECK-NEXT: call void @sink(i32 [[TMP2]]) 13; CHECK-NEXT: ret void 14; 15 %1 = load ptr, ptr %X, align 8 16 %2 = load i32, ptr %1, align 8 17 call void @sink(i32 %2) 18 ret void 19} 20 21%struct.pair = type { i32, i32 } 22 23define internal void @test_byval(ptr byval(%struct.pair) %P) { 24; CHECK: Function Attrs: memory(readwrite, argmem: none) 25; CHECK-LABEL: define {{[^@]+}}@test_byval 26; CHECK-SAME: () #[[ATTR0:[0-9]+]] { 27; CHECK-NEXT: call void @sink(i32 noundef 0) 28; CHECK-NEXT: ret void 29; 30 call void @sink(i32 0) 31 ret void 32} 33 34define void @caller(ptr %Y, ptr %P) { 35; TUNIT-LABEL: define {{[^@]+}}@caller 36; TUNIT-SAME: (ptr nofree readonly captures(none) [[Y:%.*]], ptr nofree readnone captures(none) [[P:%.*]]) { 37; TUNIT-NEXT: call void @test(ptr nofree noundef readonly align 8 captures(none) [[Y]]), !dbg [[DBG4:![0-9]+]] 38; TUNIT-NEXT: call void @test_byval(), !dbg [[DBG5:![0-9]+]] 39; TUNIT-NEXT: ret void 40; 41; CGSCC-LABEL: define {{[^@]+}}@caller 42; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[Y:%.*]], ptr nofree readnone captures(none) [[P:%.*]]) { 43; CGSCC-NEXT: call void @test(ptr nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[Y]]), !dbg [[DBG4:![0-9]+]] 44; CGSCC-NEXT: call void @test_byval(), !dbg [[DBG5:![0-9]+]] 45; CGSCC-NEXT: ret void 46; 47 call void @test(ptr %Y), !dbg !1 48 49 call void @test_byval(ptr byval(%struct.pair) %P), !dbg !6 50 ret void 51} 52 53 54!llvm.module.flags = !{!0} 55!llvm.dbg.cu = !{!3} 56 57!0 = !{i32 2, !"Debug Info Version", i32 3} 58!1 = !DILocation(line: 8, scope: !2) 59!2 = distinct !DISubprogram(name: "test", file: !5, line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !3, scopeLine: 3, scope: null) 60!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: LineTablesOnly, file: !5) 61!5 = !DIFile(filename: "test.c", directory: "") 62!6 = !DILocation(line: 9, scope: !2) 63;. 64; TUNIT: attributes #[[ATTR0]] = { memory(readwrite, argmem: none) } 65;. 66; CGSCC: attributes #[[ATTR0]] = { memory(readwrite, argmem: none) } 67;. 68; TUNIT: [[META0:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3} 69; TUNIT: [[META1:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: [[META2:![0-9]+]], producer: "{{.*}}clang version {{.*}} ", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly) 70; TUNIT: [[META2]] = !DIFile(filename: "test.c", directory: "") 71; TUNIT: [[DBG3]] = distinct !DISubprogram(name: "test", scope: null, file: [[META2]], line: 3, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: [[META1]]) 72; TUNIT: [[DBG4]] = !DILocation(line: 8, scope: [[DBG3]]) 73; TUNIT: [[DBG5]] = !DILocation(line: 9, scope: [[DBG3]]) 74;. 75; CGSCC: [[META0:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3} 76; CGSCC: [[META1:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: [[META2:![0-9]+]], producer: "{{.*}}clang version {{.*}} ", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly) 77; CGSCC: [[META2]] = !DIFile(filename: "test.c", directory: "") 78; CGSCC: [[DBG3]] = distinct !DISubprogram(name: "test", scope: null, file: [[META2]], line: 3, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: [[META1]]) 79; CGSCC: [[DBG4]] = !DILocation(line: 8, scope: [[DBG3]]) 80; CGSCC: [[DBG5]] = !DILocation(line: 9, scope: [[DBG3]]) 81;. 82