1; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s 2; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s 3source_filename = "test/DebugInfo/COFF/purge-typedef-udts.ll" 4target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 5target triple = "i686-pc-windows-msvc19.11.25506" 6 7; C++ source to regenerate: 8; $ cat t.cpp 9; struct Foo; 10; struct Bar { 11; Bar() {} 12; int X; 13; }; 14; 15; typedef Foo FooTypedef; 16; typedef Bar BarTypedef; 17; 18; int func(ptr F) { return 7; } 19; int func(const FooTypedef *F) { return func((ptr)F); } 20; int func(const BarTypedef *B) { return func((ptr)B->X); } 21 22; CHECK-NOT: UDTName: FooTypedef 23; CHECK: UDTName: BarTypedef 24 25%struct.Foo = type opaque 26%struct.Bar = type { i32 } 27 28; Function Attrs: noinline nounwind optnone 29define i32 @"\01?func@@YAHPAX@Z"(ptr %F) #0 !dbg !10 { 30entry: 31 %F.addr = alloca ptr, align 4 32 store ptr %F, ptr %F.addr, align 4 33 call void @llvm.dbg.declare(metadata ptr %F.addr, metadata !14, metadata !DIExpression()), !dbg !15 34 ret i32 7, !dbg !16 35} 36 37; Function Attrs: nounwind readnone speculatable 38declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 39 40; Function Attrs: noinline nounwind optnone 41define i32 @"\01?func@@YAHPBUFoo@@@Z"(ptr %F) #0 !dbg !17 { 42entry: 43 %F.addr = alloca ptr, align 4 44 store ptr %F, ptr %F.addr, align 4 45 call void @llvm.dbg.declare(metadata ptr %F.addr, metadata !24, metadata !DIExpression()), !dbg !25 46 %0 = load ptr, ptr %F.addr, align 4, !dbg !26 47 %call = call i32 @"\01?func@@YAHPAX@Z"(ptr %0), !dbg !27 48 ret i32 %call, !dbg !28 49} 50 51; Function Attrs: noinline nounwind optnone 52define i32 @"\01?func@@YAHPBUBar@@@Z"(ptr %B) #0 !dbg !29 { 53entry: 54 %B.addr = alloca ptr, align 4 55 store ptr %B, ptr %B.addr, align 4 56 call void @llvm.dbg.declare(metadata ptr %B.addr, metadata !42, metadata !DIExpression()), !dbg !43 57 %0 = load ptr, ptr %B.addr, align 4, !dbg !44 58 %1 = load i32, ptr %0, align 4, !dbg !45 59 %2 = inttoptr i32 %1 to ptr, !dbg !46 60 %call = call i32 @"\01?func@@YAHPAX@Z"(ptr %2), !dbg !47 61 ret i32 %call, !dbg !48 62} 63 64attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 65attributes #1 = { nounwind readnone speculatable } 66 67!llvm.dbg.cu = !{!0} 68!llvm.module.flags = !{!5, !6, !7, !8} 69!llvm.ident = !{!9} 70 71!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3) 72!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvmbuild\5Cninja", checksumkind: CSK_MD5, checksum: "27c44c8a5531845f61f582a24ef5c151") 73!2 = !{} 74!3 = !{!4} 75!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 32) 76!5 = !{i32 1, !"NumRegisterParameters", i32 0} 77!6 = !{i32 2, !"CodeView", i32 1} 78!7 = !{i32 2, !"Debug Info Version", i32 3} 79!8 = !{i32 1, !"wchar_size", i32 2} 80!9 = !{!"clang version 6.0.0 "} 81!10 = distinct !DISubprogram(name: "func", linkageName: "\01?func@@YAHPAX@Z", scope: !1, file: !1, line: 10, type: !11, isLocal: false, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 82!11 = !DISubroutineType(types: !12) 83!12 = !{!13, !4} 84!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 85!14 = !DILocalVariable(name: "F", arg: 1, scope: !10, file: !1, line: 10, type: !4) 86!15 = !DILocation(line: 10, column: 16, scope: !10) 87!16 = !DILocation(line: 10, column: 21, scope: !10) 88!17 = distinct !DISubprogram(name: "func", linkageName: "\01?func@@YAHPBUFoo@@@Z", scope: !1, file: !1, line: 11, type: !18, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 89!18 = !DISubroutineType(types: !19) 90!19 = !{!13, !20} 91!20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !21, size: 32) 92!21 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !22) 93!22 = !DIDerivedType(tag: DW_TAG_typedef, name: "FooTypedef", file: !1, line: 7, baseType: !23) 94!23 = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !1, line: 1, flags: DIFlagFwdDecl, identifier: ".?AUFoo@@") 95!24 = !DILocalVariable(name: "F", arg: 1, scope: !17, file: !1, line: 11, type: !20) 96!25 = !DILocation(line: 11, column: 28, scope: !17) 97!26 = !DILocation(line: 11, column: 52, scope: !17) 98!27 = !DILocation(line: 11, column: 40, scope: !17) 99!28 = !DILocation(line: 11, column: 33, scope: !17) 100!29 = distinct !DISubprogram(name: "func", linkageName: "\01?func@@YAHPBUBar@@@Z", scope: !1, file: !1, line: 12, type: !30, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 101!30 = !DISubroutineType(types: !31) 102!31 = !{!13, !32} 103!32 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !33, size: 32) 104!33 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !34) 105!34 = !DIDerivedType(tag: DW_TAG_typedef, name: "BarTypedef", file: !1, line: 8, baseType: !35) 106!35 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Bar", file: !1, line: 2, size: 32, elements: !36, identifier: ".?AUBar@@") 107!36 = !{!37, !38} 108!37 = !DIDerivedType(tag: DW_TAG_member, name: "X", scope: !35, file: !1, line: 4, baseType: !13, size: 32) 109!38 = !DISubprogram(name: "Bar", scope: !35, file: !1, line: 3, type: !39, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false) 110!39 = !DISubroutineType(cc: DW_CC_BORLAND_thiscall, types: !40) 111!40 = !{null, !41} 112!41 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !35, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 113!42 = !DILocalVariable(name: "B", arg: 1, scope: !29, file: !1, line: 12, type: !32) 114!43 = !DILocation(line: 12, column: 28, scope: !29) 115!44 = !DILocation(line: 12, column: 52, scope: !29) 116!45 = !DILocation(line: 12, column: 55, scope: !29) 117!46 = !DILocation(line: 12, column: 45, scope: !29) 118!47 = !DILocation(line: 12, column: 40, scope: !29) 119!48 = !DILocation(line: 12, column: 33, scope: !29) 120