1; RUN: opt -lcssa -S %s | FileCheck %s
2source_filename = "small.c"
3
4@a = common dso_local global i32 0, align 4, !dbg !0
5
6; CHECK-LABEL: @f
7define dso_local void @f() !dbg !10 {
8entry:
9  %0 = load i32, i32* @a, align 4, !dbg !17
10  %tobool1 = icmp eq i32 %0, 0, !dbg !18
11  br i1 %tobool1, label %for.end, label %for.inc.lr.ph, !dbg !18
12
13for.inc.lr.ph:                                    ; preds = %entry
14  br label %for.inc, !dbg !18
15
16for.inc:                                          ; preds = %for.inc, %for.inc.lr.ph
17  %1 = phi i32 [ %0, %for.inc.lr.ph ], [ %inc, %for.inc ]
18  call void @llvm.dbg.label(metadata !14), !dbg !19
19  %inc = add nsw i32 %1, 1, !dbg !20
20  %tobool = icmp eq i32 %inc, 0, !dbg !18
21  br i1 %tobool, label %for.cond.for.end_crit_edge, label %for.inc, !dbg !18, !llvm.loop !21
22
23for.cond.for.end_crit_edge:                       ; preds = %for.inc
24  store i32 %inc, i32* @a, align 4, !dbg !17
25  br label %for.end, !dbg !18
26
27for.end:                                          ; preds = %entry, %for.cond.for.end_crit_edge
28  ret void, !dbg !23
29}
30
31; Function Attrs: nounwind readnone speculatable
32declare void @llvm.dbg.label(metadata) #0
33
34attributes #0 = { nounwind readnone speculatable }
35
36!llvm.dbg.cu = !{!2}
37!llvm.module.flags = !{!7, !8, !9}
38
39!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
40!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
41!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
42!3 = !DIFile(filename: "small.c", directory: "./")
43!4 = !{}
44!5 = !{!0}
45!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
46!7 = !{i32 2, !"Dwarf Version", i32 4}
47!8 = !{i32 2, !"Debug Info Version", i32 3}
48!9 = !{i32 1, !"wchar_size", i32 4}
49!10 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 3, type: !11, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: true, unit: !2, retainedNodes: !13)
50!11 = !DISubroutineType(types: !12)
51!12 = !{null}
52!13 = !{!14}
53!14 = !DILabel(scope: !15, name: "L", file: !3, line: 6)
54!15 = distinct !DILexicalBlock(scope: !16, file: !3, line: 5, column: 3)
55!16 = distinct !DILexicalBlock(scope: !10, file: !3, line: 5, column: 3)
56!17 = !DILocation(line: 5, column: 10, scope: !15)
57!18 = !DILocation(line: 5, column: 3, scope: !16)
58!19 = !DILocation(line: 6, column: 3, scope: !15)
59!20 = !DILocation(line: 5, column: 14, scope: !15)
60!21 = distinct !{!21, !18, !22}
61!22 = !DILocation(line: 6, column: 5, scope: !16)
62!23 = !DILocation(line: 7, column: 1, scope: !10)
63
64