1 ; RUN: opt -S -passes=consthoist < %s | FileCheck %s
2 ; ModuleID = 'test-hoist-debug.cpp'
3 source_filename = "test-hoist-debug.cpp"
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 ; Function Attrs: noinline nounwind optnone uwtable
8 define i32 @_Z3foov() !dbg !7 {
13 %a0 = inttoptr i64 4646526064 to ptr
14 %v0 = load i32, ptr %a0, align 16, !dbg !11
15 %c = alloca i32, align 4
16 store i32 1, ptr %c, align 4
17 %0 = load i32, ptr %c, align 4
18 %cmp = icmp eq i32 %0, 0
19 br i1 %cmp, label %if.then, label %if.else
21 if.then: ; preds = %entry
22 %a1 = inttoptr i64 4646526080 to ptr
23 %v1 = load i32, ptr %a1, align 16, !dbg !11
26 if.else: ; preds = %entry
27 %a2 = inttoptr i64 4646526096 to ptr
28 %v2 = load i32, ptr %a2, align 16, !dbg !11
31 return: ; preds = %if.else, %if.then
32 %vx = phi i32 [%v1, %if.then], [%v2, %if.else]
33 %r0 = add i32 %vx, %v0
39 !llvm.module.flags = !{!3, !4, !5}
42 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 313291)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
43 !1 = !DIFile(filename: "test-hoist-debug.cpp", directory: "/tmp")
45 !3 = !{i32 2, !"Dwarf Version", i32 4}
46 !4 = !{i32 2, !"Debug Info Version", i32 3}
47 !5 = !{i32 1, !"wchar_size", i32 4}
48 !6 = !{!"clang version 6.0.0 (trunk 313291)"}
49 !7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
50 !8 = !DISubroutineType(types: !9)
52 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53 !11 = !DILocation(line: 2, column: 3, scope: !7)
54 !12 = !DILocation(line: 3, column: 3, scope: !7)
55 !13 = !DILocation(line: 4, column: 3, scope: !7)