1; REQUIRES: asserts 2; RUN: opt < %s -globalopt -stats -disable-output 2>&1 | FileCheck %s 3; CHECK: 1 globalopt - Number of global vars shrunk to booleans 4 5source_filename = "test/Transforms/GlobalOpt/2009-03-05-dbg.ll" 6 7@Stop = internal global i32 0, !dbg !0 8 9; Function Attrs: nounwind ssp 10define i32 @foo(i32 %i) #0 { 11entry: 12 %"alloca point" = bitcast i32 0 to i32 13 call void @llvm.dbg.value(metadata i32 %i, metadata !8, metadata !12), !dbg !13 14 %0 = icmp eq i32 %i, 1, !dbg !13 15 br i1 %0, label %bb, label %bb1, !dbg !13 16 17bb: ; preds = %entry 18 store i32 0, i32* @Stop, align 4, !dbg !15 19 %1 = mul nsw i32 %i, 42, !dbg !16 20 call void @llvm.dbg.value(metadata i32 %1, metadata !8, metadata !12), !dbg !16 21 br label %bb2, !dbg !16 22 23bb1: ; preds = %entry 24 store i32 1, i32* @Stop, align 4, !dbg !17 25 br label %bb2, !dbg !17 26 27bb2: ; preds = %bb1, %bb 28 %i_addr.0 = phi i32 [ %1, %bb ], [ %i, %bb1 ] 29 br label %return, !dbg !18 30 31return: ; preds = %bb2 32 ret i32 %i_addr.0, !dbg !18 33} 34 35; Function Attrs: nounwind readnone 36 37declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 38 39; Function Attrs: nounwind ssp 40define i32 @bar() #0 { 41entry: 42 %"alloca point" = bitcast i32 0 to i32 43 %0 = load i32, i32* @Stop, align 4, !dbg !19 44 %1 = icmp eq i32 %0, 1, !dbg !19 45 br i1 %1, label %bb, label %bb1, !dbg !19 46 47bb: ; preds = %entry 48 49 br label %bb2, !dbg !24 50 51bb1: ; preds = %entry 52 br label %bb2, !dbg !25 53 54bb2: ; preds = %bb1, %bb 55 %.0 = phi i32 [ 0, %bb ], [ 1, %bb1 ] 56 br label %return, !dbg !25 57 58return: ; preds = %bb2 59 ret i32 %.0, !dbg !25 60} 61 62; Function Attrs: nounwind readnone 63declare void @llvm.dbg.value(metadata, metadata, metadata) #1 64 65attributes #0 = { nounwind ssp } 66attributes #1 = { nounwind readnone } 67 68!llvm.dbg.cu = !{!2} 69!llvm.module.flags = !{!6, !7} 70 71!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 72!1 = !DIGlobalVariable(name: "Stop", scope: !2, file: !3, line: 2, type: !5, isLocal: true, isDefinition: true) 73!2 = distinct !DICompileUnit(language: DW_LANG_C89, file: !3, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4) 74!3 = !DIFile(filename: "g.c", directory: "/tmp") 75!4 = !{!0} 76!5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 77!6 = !{i32 2, !"Dwarf Version", i32 2} 78!7 = !{i32 2, !"Debug Info Version", i32 3} 79!8 = !DILocalVariable(name: "i", arg: 1, scope: !9, file: !3, line: 4, type: !5) 80!9 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !2, file: !3, line: 4, type: !10, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2)!10 = !DISubroutineType(types: !11)!11 = !{!5, !5}!12 = !DIExpression()!13 = !DILocation(line: 5, scope: !14)!14 = distinct !DILexicalBlock(scope: !9, file: !3)!15 = !DILocation(line: 6, scope: !14)!16 = !DILocation(line: 7, scope: !14)!17 = !DILocation(line: 9, scope: !14)!18 = !DILocation(line: 11, scope: !14)!19 = !DILocation(line: 14, scope: !20)!20 = distinct !DILexicalBlock(scope: !21, file: !3)!21 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope: !2, file: !3, line: 13, type: !22, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2)!22 = !DISubroutineType(types: !23)!23 = !{!5}!24 = !DILocation(line: 15, scope: !20)!25 = !DILocation(line: 16, scope: !20) 81