1; RUN: opt -S -globaldce < %s | FileCheck %s 2 3; Test that the presence of debug intrinsics isn't affecting GlobalDCE. 4; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_notremovable, i8* null }] 5; CHECK-NOT: @_GLOBAL__I_a 6 7declare void @_notremovable() 8 9@llvm.global_ctors = appending global [3 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_b, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_notremovable, i8* null }] 10 11@x = internal unnamed_addr constant i8 undef, align 1 12 13; Function Attrs: nounwind readnone 14define internal void @_GLOBAL__I_a() #1 section "__TEXT,__StaticInit,regular,pure_instructions" { 15entry: 16 ret void 17} 18 19; Function Attrs: nounwind readnone 20define internal void @_GLOBAL__I_b() #1 section "__TEXT,__StaticInit,regular,pure_instructions" { 21entry: 22 tail call void @llvm.dbg.value(metadata i8* @x, metadata !4, metadata !DIExpression(DW_OP_deref, DW_OP_constu, 0, DW_OP_swap, DW_OP_xderef)), !dbg !5 23 ret void 24} 25 26; Function Attrs: nounwind readnone speculatable 27declare void @llvm.dbg.value(metadata, metadata, metadata) 28 29!llvm.module.flags = !{!0} 30!llvm.dbg.cu = !{!1} 31 32!0 = !{i32 2, !"Debug Info Version", i32 3} 33!1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, emissionKind: FullDebug) 34!2 = !DIFile(filename: "filename", directory: "directory") 35!3 = distinct !DISubprogram(name: "h1", unit: !1) 36!4 = !DILocalVariable(name: "b", arg: 1, scope: !3) 37!5 = !DILocation(scope: !3) 38