brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.6 KiB · c5b3c74 Raw
215 lines · plain
1; Ensure that we can correctly emit a compile unit for outlined functions and2; that we correctly emit DISubprograms for those functions.3; Also make sure that the DISubprograms reference the generated unit.4; make sure that if there are two outlined functions in the program, 5; RUN: llc %s -verify-machineinstrs -enable-machine-outliner -mtriple=x86_64-apple-darwin -o /dev/null -print-after=machine-outliner6define void @f6() #0 !dbg !8 {7entry:8  %dog = alloca i32, align 49  %cat = alloca i32, align 410  %pangolin = alloca i32, align 411  call void @llvm.dbg.declare(metadata ptr %dog, metadata !11, metadata !DIExpression()), !dbg !1312  store i32 16, ptr %dog, align 4, !dbg !1313  call void @llvm.dbg.declare(metadata ptr %cat, metadata !14, metadata !DIExpression()), !dbg !1514  store i32 32, ptr %cat, align 4, !dbg !1515  call void @llvm.dbg.declare(metadata ptr %pangolin, metadata !16, metadata !DIExpression()), !dbg !1716  store i32 48, ptr %pangolin, align 4, !dbg !1717  ret void, !dbg !1818}19 20declare void @llvm.dbg.declare(metadata, metadata, metadata) #121 22define void @f5() #0 !dbg !19 {23entry:24  %dog = alloca i32, align 425  %cat = alloca i32, align 426  %pangolin = alloca i32, align 427  call void @llvm.dbg.declare(metadata ptr %dog, metadata !20, metadata !DIExpression()), !dbg !2128  store i32 16, ptr %dog, align 4, !dbg !2129  call void @llvm.dbg.declare(metadata ptr %cat, metadata !22, metadata !DIExpression()), !dbg !2330  store i32 32, ptr %cat, align 4, !dbg !2331  call void @llvm.dbg.declare(metadata ptr %pangolin, metadata !24, metadata !DIExpression()), !dbg !2532  store i32 48, ptr %pangolin, align 4, !dbg !2533  ret void, !dbg !2634}35 36define void @f4() #0 !dbg !27 {37entry:38  %dog = alloca i32, align 439  %cat = alloca i32, align 440  %pangolin = alloca i32, align 441  call void @llvm.dbg.declare(metadata ptr %dog, metadata !28, metadata !DIExpression()), !dbg !2942  store i32 16, ptr %dog, align 4, !dbg !2943  call void @llvm.dbg.declare(metadata ptr %cat, metadata !30, metadata !DIExpression()), !dbg !3144  store i32 32, ptr %cat, align 4, !dbg !3145  call void @llvm.dbg.declare(metadata ptr %pangolin, metadata !32, metadata !DIExpression()), !dbg !3346  store i32 48, ptr %pangolin, align 4, !dbg !3347  ret void, !dbg !3448}49 50define i32 @f1() #0 !dbg !35 {51entry:52  %dog = alloca i32, align 453  %cat = alloca i32, align 454  %pangolin = alloca i32, align 455  call void @llvm.dbg.declare(metadata ptr %dog, metadata !38, metadata !DIExpression()), !dbg !3956  store i32 1, ptr %dog, align 4, !dbg !3957  call void @llvm.dbg.declare(metadata ptr %cat, metadata !40, metadata !DIExpression()), !dbg !4158  store i32 2, ptr %cat, align 4, !dbg !4159  call void @llvm.dbg.declare(metadata ptr %pangolin, metadata !42, metadata !DIExpression()), !dbg !4360  store i32 3, ptr %pangolin, align 4, !dbg !4361  store i32 16, ptr %dog, align 4, !dbg !4462  %0 = load i32, ptr %dog, align 4, !dbg !4563  ret i32 %0, !dbg !4664}65 66define i32 @f2() #0 !dbg !47 {67entry:68  %dog = alloca i32, align 469  %cat = alloca i32, align 470  %pangolin = alloca i32, align 471  call void @llvm.dbg.declare(metadata ptr %dog, metadata !48, metadata !DIExpression()), !dbg !4972  store i32 1, ptr %dog, align 4, !dbg !4973  call void @llvm.dbg.declare(metadata ptr %cat, metadata !50, metadata !DIExpression()), !dbg !5174  store i32 2, ptr %cat, align 4, !dbg !5175  call void @llvm.dbg.declare(metadata ptr %pangolin, metadata !52, metadata !DIExpression()), !dbg !5376  store i32 3, ptr %pangolin, align 4, !dbg !5377  store i32 16, ptr %dog, align 4, !dbg !5478  %0 = load i32, ptr %dog, align 4, !dbg !5579  ret i32 %0, !dbg !5680}81 82define i32 @f3() #0 !dbg !57 {83entry:84  %dog = alloca i32, align 485  %cat = alloca i32, align 486  %pangolin = alloca i32, align 487  call void @llvm.dbg.declare(metadata ptr %dog, metadata !58, metadata !DIExpression()), !dbg !5988  store i32 1, ptr %dog, align 4, !dbg !5989  call void @llvm.dbg.declare(metadata ptr %cat, metadata !60, metadata !DIExpression()), !dbg !6190  store i32 2, ptr %cat, align 4, !dbg !6191  call void @llvm.dbg.declare(metadata ptr %pangolin, metadata !62, metadata !DIExpression()), !dbg !6392  store i32 3, ptr %pangolin, align 4, !dbg !6393  store i32 16, ptr %dog, align 4, !dbg !6494  %0 = load i32, ptr %dog, align 4, !dbg !6595  ret i32 %0, !dbg !6696}97 98define i32 @main() #0 !dbg !67 {99entry:100  %retval = alloca i32, align 4101  %a = alloca i32, align 4102  store i32 0, ptr %retval, align 4103  call void @llvm.dbg.declare(metadata ptr %a, metadata !68, metadata !DIExpression()), !dbg !69104  store i32 4, ptr %a, align 4, !dbg !69105  %call = call i32 @f1() #2, !dbg !70106  %call1 = call i32 @f2() #2, !dbg !71107  %call2 = call i32 @f3() #2, !dbg !72108  ret i32 0, !dbg !73109}110 111; CHECK: distinct !DISubprogram(name: "OUTLINED_FUNCTION_1",112; CHECK-SAME: scope: !1,113; CHECK-SAME: file: !1,114; CHECK-SAME: type: [[TYPE:![0-9]+]],115; CHECK-SAME: isLocal: false, 116; CHECK-SAME: isDefinition: true,117; CHECK-SAME: flags: DIFlagArtificial,118; CHECK-SAME: isOptimized: true,119; CHECK-SAME: unit: !0,120; CHECK-SAME: retainedNodes: [[VARS:![0-9]+]]121 122; CHECK: distinct !DISubprogram(name: "OUTLINED_FUNCTION_0",123; CHECK-SAME: scope: !1,124; CHECK-SAME: file: !1,125; CHECK-SAME: type: [[TYPE]],126; CHECK-SAME: isLocal: false, 127; CHECK-SAME: isDefinition: true,128; CHECK-SAME: flags: DIFlagArtificial,129; CHECK-SAME: isOptimized: true,130; CHECK-SAME: unit: !0,131; CHECK-SAME: retainedNodes: [[VARS]]132 133attributes #0 = { noinline noredzone nounwind optnone ssp uwtable "frame-pointer"="all"  }134attributes #1 = { nounwind readnone speculatable }135attributes #2 = { noredzone }136 137!llvm.dbg.cu = !{!0}138!llvm.module.flags = !{!3, !4, !5, !6}139!llvm.ident = !{!7}140 141!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)142!1 = !DIFile(filename: "test.c", directory: "/")143!2 = !{}144!3 = !{i32 2, !"Dwarf Version", i32 4}145!4 = !{i32 2, !"Debug Info Version", i32 3}146!5 = !{i32 1, !"wchar_size", i32 4}147!6 = !{i32 7, !"PIC Level", i32 2}148!7 = !{!"clang"}149!8 = distinct !DISubprogram(name: "f6", scope: !1, file: !1, line: 3, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !0, retainedNodes: !2)150!9 = !DISubroutineType(types: !10)151!10 = !{null}152!11 = !DILocalVariable(name: "dog", scope: !8, file: !1, line: 4, type: !12)153!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)154!13 = !DILocation(line: 4, column: 16, scope: !8)155!14 = !DILocalVariable(name: "cat", scope: !8, file: !1, line: 5, type: !12)156!15 = !DILocation(line: 5, column: 16, scope: !8)157!16 = !DILocalVariable(name: "pangolin", scope: !8, file: !1, line: 6, type: !12)158!17 = !DILocation(line: 6, column: 16, scope: !8)159!18 = !DILocation(line: 7, column: 1, scope: !8)160!19 = distinct !DISubprogram(name: "f5", scope: !1, file: !1, line: 9, type: !9, isLocal: false, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !0, retainedNodes: !2)161!20 = !DILocalVariable(name: "dog", scope: !19, file: !1, line: 10, type: !12)162!21 = !DILocation(line: 10, column: 16, scope: !19)163!22 = !DILocalVariable(name: "cat", scope: !19, file: !1, line: 11, type: !12)164!23 = !DILocation(line: 11, column: 16, scope: !19)165!24 = !DILocalVariable(name: "pangolin", scope: !19, file: !1, line: 12, type: !12)166!25 = !DILocation(line: 12, column: 16, scope: !19)167!26 = !DILocation(line: 13, column: 1, scope: !19)168!27 = distinct !DISubprogram(name: "f4", scope: !1, file: !1, line: 15, type: !9, isLocal: false, isDefinition: true, scopeLine: 15, isOptimized: false, unit: !0, retainedNodes: !2)169!28 = !DILocalVariable(name: "dog", scope: !27, file: !1, line: 16, type: !12)170!29 = !DILocation(line: 16, column: 16, scope: !27)171!30 = !DILocalVariable(name: "cat", scope: !27, file: !1, line: 17, type: !12)172!31 = !DILocation(line: 17, column: 16, scope: !27)173!32 = !DILocalVariable(name: "pangolin", scope: !27, file: !1, line: 18, type: !12)174!33 = !DILocation(line: 18, column: 16, scope: !27)175!34 = !DILocation(line: 19, column: 1, scope: !27)176!35 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 21, type: !36, isLocal: false, isDefinition: true, scopeLine: 21, isOptimized: false, unit: !0, retainedNodes: !2)177!36 = !DISubroutineType(types: !37)178!37 = !{!12}179!38 = !DILocalVariable(name: "dog", scope: !35, file: !1, line: 22, type: !12)180!39 = !DILocation(line: 22, column: 16, scope: !35)181!40 = !DILocalVariable(name: "cat", scope: !35, file: !1, line: 23, type: !12)182!41 = !DILocation(line: 23, column: 16, scope: !35)183!42 = !DILocalVariable(name: "pangolin", scope: !35, file: !1, line: 24, type: !12)184!43 = !DILocation(line: 24, column: 16, scope: !35)185!44 = !DILocation(line: 25, column: 7, scope: !35)186!45 = !DILocation(line: 26, column: 10, scope: !35)187!46 = !DILocation(line: 26, column: 3, scope: !35)188!47 = distinct !DISubprogram(name: "f2", scope: !1, file: !1, line: 29, type: !36, isLocal: false, isDefinition: true, scopeLine: 29, isOptimized: false, unit: !0, retainedNodes: !2)189!48 = !DILocalVariable(name: "dog", scope: !47, file: !1, line: 30, type: !12)190!49 = !DILocation(line: 30, column: 16, scope: !47)191!50 = !DILocalVariable(name: "cat", scope: !47, file: !1, line: 31, type: !12)192!51 = !DILocation(line: 31, column: 16, scope: !47)193!52 = !DILocalVariable(name: "pangolin", scope: !47, file: !1, line: 32, type: !12)194!53 = !DILocation(line: 32, column: 16, scope: !47)195!54 = !DILocation(line: 33, column: 7, scope: !47)196!55 = !DILocation(line: 34, column: 10, scope: !47)197!56 = !DILocation(line: 34, column: 3, scope: !47)198!57 = distinct !DISubprogram(name: "f3", scope: !1, file: !1, line: 37, type: !36, isLocal: false, isDefinition: true, scopeLine: 37, isOptimized: false, unit: !0, retainedNodes: !2)199!58 = !DILocalVariable(name: "dog", scope: !57, file: !1, line: 38, type: !12)200!59 = !DILocation(line: 38, column: 16, scope: !57)201!60 = !DILocalVariable(name: "cat", scope: !57, file: !1, line: 39, type: !12)202!61 = !DILocation(line: 39, column: 16, scope: !57)203!62 = !DILocalVariable(name: "pangolin", scope: !57, file: !1, line: 40, type: !12)204!63 = !DILocation(line: 40, column: 16, scope: !57)205!64 = !DILocation(line: 41, column: 7, scope: !57)206!65 = !DILocation(line: 42, column: 10, scope: !57)207!66 = !DILocation(line: 42, column: 3, scope: !57)208!67 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 45, type: !36, isLocal: false, isDefinition: true, scopeLine: 45, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)209!68 = !DILocalVariable(name: "a", scope: !67, file: !1, line: 46, type: !12)210!69 = !DILocation(line: 46, column: 16, scope: !67)211!70 = !DILocation(line: 47, column: 3, scope: !67)212!71 = !DILocation(line: 48, column: 3, scope: !67)213!72 = !DILocation(line: 49, column: 3, scope: !67)214!73 = !DILocation(line: 51, column: 3, scope: !67)215