1 ; RUN: opt < %s -simplifycfg -S | FileCheck %s
3 ; TODO: Track the acutal DebugLoc of the hoisted instruction when no-line
4 ; DebugLoc is supported (https://reviews.llvm.org/D24180)
6 ; Checks if the debug info for hoisted "x = i" is removed and
7 ; the debug info for hoisted "bar()" is set as line 0
23 target triple = "x86_64-unknown-linux-gnu"
25 @x = global i32 0, align 4
27 ; Function Attrs: uwtable
28 define void @_Z3fooi(i32) #0 !dbg !6 {
29 ; CHECK: load i32, i32* %2, align 4, !dbg ![[LOAD:[0-9]+]], !tbaa
30 ; CHECK: store i32 %5, i32* @x, align 4, !dbg ![[BAR:[0-9]+]], !tbaa
31 ; CHECK: call void @_Z3barv(), !dbg ![[BAR]]
32 ; CHECK: call void @_Z3bazv(), !dbg ![[BAZ:[0-9]+]]
33 %2 = alloca i32, align 4
34 store i32 %0, i32* %2, align 4, !tbaa !8
35 %3 = load i32, i32* %2, align 4, !dbg !12, !tbaa !8
36 %4 = icmp eq i32 %3, 0, !dbg !13
37 br i1 %4, label %5, label %7, !dbg !12
40 %6 = load i32, i32* %2, align 4, !dbg !14, !tbaa !8
41 store i32 %6, i32* @x, align 4, !dbg !15, !tbaa !8
42 call void @_Z3barv(), !dbg !16
46 %8 = load i32, i32* %2, align 4, !dbg !18, !tbaa !8
47 store i32 %8, i32* @x, align 4, !dbg !19, !tbaa !8
48 call void @_Z3barv(), !dbg !20
49 call void @_Z3bazv(), !dbg !21
56 declare void @_Z3barv() #1
58 declare void @_Z3bazv() #1
61 !llvm.module.flags = !{!3, !4}
63 ; CHECK: ![[LOAD]] = !DILocation(line: 6, column: 7
64 ; CHECK: ![[BAR]] = !DILocation(line: 0
65 ; CHECK: ![[BAZ]] = !DILocation(line: 12, column: 5
66 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
67 !1 = !DIFile(filename: "a", directory: "b/")
69 !3 = !{i32 2, !"Dwarf Version", i32 4}
70 !4 = !{i32 2, !"Debug Info Version", i32 3}
72 !6 = distinct !DISubprogram(unit: !0)
73 !7 = !DISubroutineType(types: !2)
75 !9 = !{!"int", !10, i64 0}
76 !10 = !{!"omnipotent char", !11, i64 0}
77 !11 = !{!"Simple C++ TBAA"}
78 !12 = !DILocation(line: 6, column: 7, scope: !6)
79 !13 = !DILocation(line: 6, column: 9, scope: !6)
80 !14 = !DILocation(line: 7, column: 9, scope: !6)
81 !15 = !DILocation(line: 7, column: 7, scope: !6)
82 !16 = !DILocation(line: 8, column: 5, scope: !6)
83 !17 = !DILocation(line: 9, column: 3, scope: !6)
84 !18 = !DILocation(line: 10, column: 9, scope: !6)
85 !19 = !DILocation(line: 10, column: 7, scope: !6)
86 !20 = !DILocation(line: 11, column: 5, scope: !6)
87 !21 = !DILocation(line: 12, column: 5, scope: !6)
88 !22 = !DILocation(line: 14, column: 1, scope: !6)