xref: /llvm-project/llvm/test/CodeGen/ARM/2016-08-24-ARM-LDST-dbginfo-bug.ll (revision bed1c7f061aa12417aa081e334afdba45767b938)
1; RUN: llc < %s -mtriple=thumbv7em-arm-none-eabi -O3
2
3; When using -Oz and -g, this code generated an abort in the ARM load/store optimizer.
4
5%struct.s = type { ptr }
6
7; Function Attrs: minsize nounwind optsize readonly
8define ptr @s_idx(ptr readonly %xl) local_unnamed_addr #0 !dbg !8 {
9entry:
10  tail call void @llvm.dbg.value(metadata ptr %xl, metadata !17, metadata !18), !dbg !19
11  br label %while.cond, !dbg !20
12
13while.cond:                                       ; preds = %while.body, %entry
14  %xl.addr.0 = phi ptr [ %xl, %entry ], [ %0, %while.body ]
15  %tobool = icmp eq ptr %xl.addr.0, null
16  br i1 %tobool, label %while.end, label %while.body
17
18while.body:                                       ; preds = %while.cond
19  %0 = load ptr, ptr %xl.addr.0, align 4
20  tail call void @llvm.dbg.value(metadata ptr %0, metadata !17, metadata !18), !dbg !19
21  br label %while.cond
22
23while.end:                                        ; preds = %while.cond
24  ret ptr null
25}
26
27; Function Attrs: nounwind readnone
28declare void @llvm.dbg.value(metadata, metadata, metadata) #1
29
30!llvm.dbg.cu = !{!0}
31!llvm.module.flags = !{!3, !4, !5, !6}
32
33!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
34!1 = !DIFile(filename: "test.c", directory: "/a/b/c")
35!2 = !{}
36!3 = !{i32 2, !"Dwarf Version", i32 4}
37!4 = !{i32 2, !"Debug Info Version", i32 3}
38!5 = !{i32 1, !"wchar_size", i32 4}
39!6 = !{i32 1, !"min_enum_size", i32 4}
40!7 = !{!"clang version 4.0.0 "}
41!8 = distinct !DISubprogram(name: "s_idx", scope: !1, file: !1, line: 6, type: !9, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !16)
42!9 = !DISubroutineType(types: !10)
43!10 = !{!11, !11}
44!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "ezxml_t", file: !1, line: 1, baseType: !12)
45!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 32, align: 32)
46!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s", file: !1, line: 2, size: 32, align: 32, elements: !14)
47!14 = !{!15}
48!15 = !DIDerivedType(tag: DW_TAG_member, name: "next", scope: !13, file: !1, line: 3, baseType: !11, size: 32, align: 32)
49!16 = !{!17}
50!17 = !DILocalVariable(name: "xl", arg: 1, scope: !8, file: !1, line: 6, type: !11)
51!18 = !DIExpression()
52!19 = !DILocation(line: 6, column: 27, scope: !8)
53!20 = !DILocation(line: 8, column: 5, scope: !8)
54