xref: /llvm-project/llvm/test/Transforms/ConstantHoisting/X86/dbg-dominatingblock.ll (revision 055fb7795aa219a3d274d280ec9129784f169f56)
1; RUN: opt -S -passes=consthoist < %s | FileCheck %s
2; ModuleID = 'test-hoist-debug.cpp'
3source_filename = "test-hoist-debug.cpp"
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-unknown-linux-gnu"
6
7; Function Attrs: noinline nounwind optnone uwtable
8define i32 @_Z3foov() !dbg !7 {
9; CHECK: bitcast
10; CHECK-NOT: !dbg !11
11; CHECK: inttoptr
12entry:
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
20
21if.then:                                          ; preds = %entry
22  %a1 = inttoptr i64 4646526080 to ptr
23  %v1 = load i32, ptr %a1, align 16, !dbg !11
24  br label %return
25
26if.else:                                          ; preds = %entry
27  %a2 = inttoptr i64 4646526096 to ptr
28  %v2 = load i32, ptr %a2, align 16, !dbg !11
29  br label %return
30
31return:                                           ; preds = %if.else, %if.then
32  %vx = phi i32 [%v1, %if.then], [%v2, %if.else]
33  %r0 = add i32 %vx, %v0
34
35  ret i32 %r0
36}
37
38!llvm.dbg.cu = !{!0}
39!llvm.module.flags = !{!3, !4, !5}
40!llvm.ident = !{!6}
41
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")
44!2 = !{}
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)
51!9 = !{!10}
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)
56