1 ; RUN: opt -S -reassociate < %s | FileCheck %s
5 ; Verify that the original debug location is kept if the
6 ; replacement debug location is missing when
7 ; reassociating expressions.
9 define i16 @fn1() !dbg !3 {
13 define void @fn2() !dbg !6 {
15 ; CHECK: call i16 @fn1(), !dbg ![[LOC1:[0-9]+]]
17 %inlinable_call = call i16 @fn1(), !dbg !7
18 %dbgless_instruction = or i16 %inlinable_call, 0
19 store i16 %dbgless_instruction, i16* undef, align 1
23 define void @fn3() !dbg !8 {
25 ; CHECK: load i16, i16* undef, align 2, !dbg ![[LOC2:[0-9]+]]
27 %instruction = load i16, i16* undef, !dbg !9
28 %dbgless_instruction = or i16 %instruction, 0
29 store i16 %dbgless_instruction, i16* undef, align 1
33 ; CHECK: ![[LOC1]] = !DILocation(line: 7
34 ; CHECK: ![[LOC2]] = !DILocation(line: 9
37 !llvm.module.flags = !{!2}
39 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly)
40 !1 = !DIFile(filename: "foo.c", directory: "/")
41 !2 = !{i32 2, !"Debug Info Version", i32 3}
42 !3 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 2, type: !4, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: true, unit: !0)
43 !4 = !DISubroutineType(types: !5)
45 !6 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 3, type: !4, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0)
46 !7 = !DILocation(line: 7, column: 10, scope: !6)
47 !8 = distinct !DISubprogram(name: "fn3", scope: !1, file: !1, line: 8, type: !4, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0)
48 !9 = !DILocation(line: 9, column: 10, scope: !8)