1; Round trip test for DW_OP_LLVM_implicit_pointer metadata 2 3; RUN: llvm-as < %s | llvm-dis | FileCheck %s 4 5;--------------------------- 6;static const char *b = "opq"; 7;volatile int v; 8;int main() { 9; int var = 4; 10; int *ptr1; 11; int **ptr2; 12; 13; v++; 14; ptr1 = &var; 15; ptr2 = &ptr1; 16; v++; 17; 18; return *ptr1 - 5 + **ptr2; 19;} 20;--------------------------- 21 22; ModuleID = 'LLVM_implicit_pointer.c' 23source_filename = "LLVM_implicit_pointer.c" 24target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 25target triple = "x86_64-unknown-linux-gnu" 26 27@v = dso_local global i32 0, align 4, !dbg !0 28 29; Function Attrs: nofree norecurse nounwind uwtable 30define dso_local i32 @main() local_unnamed_addr !dbg !12 { 31entry: 32; CHECK: #dbg_value(i32 4, [[VAR:![0-9]+]], !DIExpression(), 33 call void @llvm.dbg.value(metadata i32 4, metadata !16, metadata !DIExpression()), !dbg !21 34 %0 = load volatile i32, ptr @v, align 4, !dbg !22, !tbaa !23 35 %inc = add nsw i32 %0, 1, !dbg !22 36 store volatile i32 %inc, ptr @v, align 4, !dbg !22, !tbaa !23 37 38; CHECK: #dbg_value(i32 4, [[PTR1:![0-9]+]], !DIExpression(DW_OP_LLVM_implicit_pointer), 39 call void @llvm.dbg.value(metadata i32 4, metadata !17, metadata !DIExpression(DW_OP_LLVM_implicit_pointer)), !dbg !21 40 41; CHECK: #dbg_value(i32 4, [[PTR2:![0-9]+]], !DIExpression(DW_OP_LLVM_implicit_pointer, DW_OP_LLVM_implicit_pointer), 42 call void @llvm.dbg.value(metadata i32 4, metadata !19, metadata !DIExpression(DW_OP_LLVM_implicit_pointer, DW_OP_LLVM_implicit_pointer)), !dbg !21 43 %1 = load volatile i32, ptr @v, align 4, !dbg !27, !tbaa !23 44 %inc1 = add nsw i32 %1, 1, !dbg !27 45 store volatile i32 %inc1, ptr @v, align 4, !dbg !27, !tbaa !23 46 ret i32 3, !dbg !28 47} 48 49; Function Attrs: nofree nosync nounwind readnone speculatable willreturn 50declare void @llvm.dbg.value(metadata, metadata, metadata) #1 51 52!llvm.dbg.cu = !{!2} 53!llvm.module.flags = !{!8, !9, !10} 54!llvm.ident = !{!11} 55 56!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 57!1 = distinct !DIGlobalVariable(name: "v", scope: !2, file: !3, line: 2, type: !6, isLocal: false, isDefinition: true) 58!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None) 59!3 = !DIFile(filename: "LLVM_implicit_pointer.c", directory: "/dir", checksumkind: CSK_MD5, checksum: "218aaa8dc9f04b056b56d944d06383dd") 60!4 = !{} 61!5 = !{!0} 62!6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7) 63!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 64!8 = !{i32 7, !"Dwarf Version", i32 5} 65!9 = !{i32 2, !"Debug Info Version", i32 3} 66!10 = !{i32 1, !"wchar_size", i32 4} 67!11 = !{!"clang version 12.0.0"} 68!12 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 3, type: !13, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !15) 69!13 = !DISubroutineType(types: !14) 70!14 = !{!7} 71!15 = !{!16, !17, !19} 72; CHECK: [[VAR]] = !DILocalVariable(name: "var" 73!16 = !DILocalVariable(name: "var", scope: !12, file: !3, line: 4, type: !7) 74; CHECK: [[PTR1]] = !DILocalVariable(name: "ptr1" 75!17 = !DILocalVariable(name: "ptr1", scope: !12, file: !3, line: 5, type: !18) 76!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64) 77; CHECK: [[PTR2]] = !DILocalVariable(name: "ptr2" 78!19 = !DILocalVariable(name: "ptr2", scope: !12, file: !3, line: 6, type: !20) 79!20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !18, size: 64) 80!21 = !DILocation(line: 0, scope: !12) 81!22 = !DILocation(line: 8, column: 4, scope: !12) 82!23 = !{!24, !24, i64 0} 83!24 = !{!"int", !25, i64 0} 84!25 = !{!"omnipotent char", !26, i64 0} 85!26 = !{!"Simple C/C++ TBAA"} 86!27 = !DILocation(line: 11, column: 4, scope: !12) 87!28 = !DILocation(line: 13, column: 3, scope: !12) 88