1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals 2; Test that SROA can deal with allocas that have more than one 3; dbg.declare hanging off of it. 4 5; RUN: opt < %s -passes='sroa<preserve-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG 6; RUN: opt < %s -passes='sroa<modify-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG 7 8;; Duplicate copies for RemoveDIs, eliminating debug intrinsics. 9; RUN: opt < %s -passes='sroa<preserve-cfg>' -S --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG 10; RUN: opt < %s -passes='sroa<modify-cfg>' -S --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG 11 12source_filename = "/tmp/inlinesplit.cpp" 13target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 14target triple = "x86_64-apple-macosx10.15.0" 15 16%struct.pair = type { i64, i64 } 17 18; Function Attrs: noinline optnone ssp uwtable 19define i64 @_Z1g4pair(i64 %p.coerce0, i64 %p.coerce1) #0 !dbg !8 { 20; CHECK-LABEL: @_Z1g4pair( 21; CHECK-NEXT: entry: 22; CHECK-NEXT: #dbg_value(i64 [[P_COERCE0:%.*]], [[META16:![0-9]+]], !DIExpression(DW_OP_LLVM_fragment, 0, 64), [[META17:![0-9]+]]) 23; CHECK-NEXT: #dbg_value(i64 [[P_COERCE0]], [[META18:![0-9]+]], !DIExpression(DW_OP_LLVM_fragment, 0, 64), [[META20:![0-9]+]]) 24; CHECK-NEXT: #dbg_value(i64 [[P_COERCE1:%.*]], [[META16]], !DIExpression(DW_OP_LLVM_fragment, 64, 64), [[META17]]) 25; CHECK-NEXT: #dbg_value(i64 [[P_COERCE1]], [[META18]], !DIExpression(DW_OP_LLVM_fragment, 64, 64), [[META20]]) 26; CHECK-NEXT: ret i64 [[P_COERCE0]], !dbg [[DBG22:![0-9]+]] 27; 28entry: 29 %p = alloca %struct.pair, align 8 30 store i64 %p.coerce0, ptr %p, align 8 31 %0 = getelementptr inbounds %struct.pair, ptr %p, i32 0, i32 1 32 store i64 %p.coerce1, ptr %0, align 8 33 call void @llvm.dbg.declare(metadata ptr %p, metadata !17, metadata !DIExpression()), !dbg !18 34 call void @llvm.dbg.declare(metadata ptr %p, metadata !21, metadata !DIExpression()), !dbg !23 35 %x2 = load i64, ptr %p, align 8, !dbg !25 36 ret i64 %x2, !dbg !26 37} 38 39; Function Attrs: nounwind readnone speculatable willreturn 40declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 41 42; Function Attrs: argmemonly nounwind willreturn 43declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2 44 45attributes #0 = { noinline ssp uwtable } 46attributes #1 = { nounwind readnone speculatable willreturn } 47attributes #2 = { argmemonly nounwind willreturn } 48 49!llvm.dbg.cu = !{!0} 50!llvm.module.flags = !{!3, !4, !5, !6} 51 52!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0 (git@github.com:llvm/llvm-project 5110fd0343c2d06c8ae538741fbef13ece5e68de)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None, sysroot: "/") 53!1 = !DIFile(filename: "/tmp/inlinesplit.cpp", directory: "/Volumes/Data/llvm-project") 54!2 = !{} 55!3 = !{i32 7, !"Dwarf Version", i32 4} 56!4 = !{i32 2, !"Debug Info Version", i32 3} 57!5 = !{i32 1, !"wchar_size", i32 4} 58!6 = !{i32 7, !"PIC Level", i32 2} 59!8 = distinct !DISubprogram(name: "g", linkageName: "_Z1g4pair", scope: !9, file: !9, line: 9, type: !10, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 60!9 = !DIFile(filename: "/tmp/inlinesplit.cpp", directory: "") 61!10 = !DISubroutineType(types: !11) 62!11 = !{!12, !13} 63!12 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) 64!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "pair", file: !9, line: 1, size: 128, flags: DIFlagTypePassByValue, elements: !14, identifier: "_ZTS4pair") 65!14 = !{!15, !16} 66!15 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !13, file: !9, line: 1, baseType: !12, size: 64) 67!16 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !13, file: !9, line: 1, baseType: !12, size: 64, offset: 64) 68!17 = !DILocalVariable(name: "p", arg: 1, scope: !8, file: !9, line: 9, type: !13) 69!18 = !DILocation(line: 9, column: 27, scope: !8) 70!19 = !DILocation(line: 10, column: 12, scope: !8) 71!20 = !DILocation(line: 10, column: 10, scope: !8) 72!21 = !DILocalVariable(name: "p", arg: 1, scope: !22, file: !9, line: 5, type: !13) 73!22 = distinct !DISubprogram(name: "f", linkageName: "_ZL1f4pair", scope: !9, file: !9, line: 5, type: !10, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2) 74!23 = !DILocation(line: 5, column: 27, scope: !22, inlinedAt: !24) 75!24 = distinct !DILocation(line: 10, column: 10, scope: !8) 76!25 = !DILocation(line: 6, column: 12, scope: !22, inlinedAt: !24) 77!26 = !DILocation(line: 10, column: 3, scope: !8) 78;. 79; CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline ssp uwtable } 80; CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } 81;. 82; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]], nameTableKind: None, sysroot: "/") 83; CHECK: [[META1]] = !DIFile(filename: "/tmp/inlinesplit.cpp", directory: {{.*}}) 84; CHECK: [[META2]] = !{} 85; CHECK: [[META3:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 4} 86; CHECK: [[META4:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3} 87; CHECK: [[META5:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} 88; CHECK: [[META6:![0-9]+]] = !{i32 8, !"PIC Level", i32 2} 89; CHECK: [[META7:![0-9]+]] = distinct !DISubprogram(name: "g", linkageName: "_Z1g4pair", scope: [[META8:![0-9]+]], file: [[META8]], line: 9, type: [[META9:![0-9]+]], scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META2]]) 90; CHECK: [[META8]] = !DIFile(filename: "/tmp/inlinesplit.cpp", directory: "") 91; CHECK: [[META9]] = !DISubroutineType(types: [[META10:![0-9]+]]) 92; CHECK: [[META10]] = !{[[META11:![0-9]+]], [[META12:![0-9]+]]} 93; CHECK: [[META11]] = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) 94; CHECK: [[META12]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "pair", file: [[META8]], line: 1, size: 128, flags: DIFlagTypePassByValue, elements: [[META13:![0-9]+]], identifier: "_ZTS4pair") 95; CHECK: [[META13]] = !{[[META14:![0-9]+]], [[META15:![0-9]+]]} 96; CHECK: [[META14]] = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: [[META12]], file: [[META8]], line: 1, baseType: [[META11]], size: 64) 97; CHECK: [[META15]] = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: [[META12]], file: [[META8]], line: 1, baseType: [[META11]], size: 64, offset: 64) 98; CHECK: [[META16]] = !DILocalVariable(name: "p", arg: 1, scope: [[META7]], file: [[META8]], line: 9, type: [[META12]]) 99; CHECK: [[META17]] = !DILocation(line: 0, scope: [[META7]]) 100; CHECK: [[META18]] = !DILocalVariable(name: "p", arg: 1, scope: [[META19:![0-9]+]], file: [[META8]], line: 5, type: [[META12]]) 101; CHECK: [[META19]] = distinct !DISubprogram(name: "f", linkageName: "_ZL1f4pair", scope: [[META8]], file: [[META8]], line: 5, type: [[META9]], scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META2]]) 102; CHECK: [[META20]] = !DILocation(line: 0, scope: [[META19]], inlinedAt: [[META21:![0-9]+]]) 103; CHECK: [[META21]] = distinct !DILocation(line: 10, column: 10, scope: [[META7]]) 104; CHECK: [[DBG22]] = !DILocation(line: 10, column: 3, scope: [[META7]]) 105;. 106;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: 107; CHECK-MODIFY-CFG: {{.*}} 108; CHECK-PRESERVE-CFG: {{.*}} 109