81 lines · plain
1; REQUIRES: asserts2; RUN: opt < %s -passes=globalopt -stats -disable-output 2>&1 | FileCheck %s3; CHECK: 1 globalopt - Number of global vars shrunk to booleans4 5source_filename = "test/Transforms/GlobalOpt/2009-03-05-dbg.ll"6 7@Stop = internal global i32 0, !dbg !08 9; Function Attrs: nounwind ssp10define i32 @foo(i32 %i) #0 {11entry:12 %"alloca point" = bitcast i32 0 to i3213 call void @llvm.dbg.value(metadata i32 %i, metadata !8, metadata !12), !dbg !1314 %0 = icmp eq i32 %i, 1, !dbg !1315 br i1 %0, label %bb, label %bb1, !dbg !1316 17bb: ; preds = %entry18 store i32 0, ptr @Stop, align 4, !dbg !1519 %1 = mul nsw i32 %i, 42, !dbg !1620 call void @llvm.dbg.value(metadata i32 %1, metadata !8, metadata !12), !dbg !1621 br label %bb2, !dbg !1622 23bb1: ; preds = %entry24 store i32 1, ptr @Stop, align 4, !dbg !1725 br label %bb2, !dbg !1726 27bb2: ; preds = %bb1, %bb28 %i_addr.0 = phi i32 [ %1, %bb ], [ %i, %bb1 ]29 br label %return, !dbg !1830 31return: ; preds = %bb232 ret i32 %i_addr.0, !dbg !1833}34 35; Function Attrs: nounwind readnone36 37declare void @llvm.dbg.declare(metadata, metadata, metadata) #138 39; Function Attrs: nounwind ssp40define i32 @bar() #0 {41entry:42 %"alloca point" = bitcast i32 0 to i3243 %0 = load i32, ptr @Stop, align 4, !dbg !1944 %1 = icmp eq i32 %0, 1, !dbg !1945 br i1 %1, label %bb, label %bb1, !dbg !1946 47bb: ; preds = %entry48 49 br label %bb2, !dbg !2450 51bb1: ; preds = %entry52 br label %bb2, !dbg !2553 54bb2: ; preds = %bb1, %bb55 %.0 = phi i32 [ 0, %bb ], [ 1, %bb1 ]56 br label %return, !dbg !2557 58return: ; preds = %bb259 ret i32 %.0, !dbg !2560}61 62; Function Attrs: nounwind readnone63declare void @llvm.dbg.value(metadata, metadata, metadata) #164 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