xref: /llvm-project/llvm/test/DebugInfo/assignment-tracking/X86/large-type.ll (revision 30845e8ab46c416a2e333eb84239e9ec71e92617)
1; RUN: llc %s -stop-after=finalize-isel -o - \
2; RUN: | FileCheck %s --implicit-check-not=DBG_
3
4
5; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - \
6; RUN: | FileCheck %s --implicit-check-not=DBG_
7
8;; Based on optimized IR from C source:
9;; int main () {
10;;   char a1[__INT_MAX__];
11;;   a1[__INT_MAX__ - 1] = 5;
12;;   return a1[__INT_MAX__ - 1];
13;; }
14;;
15;; Check extremely large types don't cause a crash.
16; CHECK: DBG_VALUE 5, $noreg, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 4294967280, 8)
17; CHECK: DBG_VALUE 6, $noreg, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 0, 8)
18; CHECK: DBG_VALUE 7, $noreg, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 0, 8)
19
20define dso_local i32 @main() local_unnamed_addr !dbg !10 {
21entry:
22;; FIXME: SROA currently creates incorrect fragments if bit_offset > max(u32),
23;; with and without assignment-tracking.
24  tail call void @llvm.dbg.value(metadata i8 5, metadata !15, metadata !DIExpression(DW_OP_LLVM_fragment, 4294967280, 8)), !dbg !20
25;; These two were inserted by hand.
26  tail call void @llvm.dbg.value(metadata i8 6, metadata !22, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8)), !dbg !20
27  tail call void @llvm.dbg.value(metadata i8 7, metadata !23, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8)), !dbg !20
28  ret i32 5, !dbg !21
29}
30
31declare void @llvm.dbg.value(metadata, metadata, metadata)
32
33!llvm.dbg.cu = !{!0}
34!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
35!llvm.ident = !{!9}
36
37!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 18.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
38!1 = !DIFile(filename: "test.c", directory: "/")
39!2 = !{i32 7, !"Dwarf Version", i32 5}
40!3 = !{i32 2, !"Debug Info Version", i32 3}
41!4 = !{i32 1, !"wchar_size", i32 4}
42!5 = !{i32 8, !"PIC Level", i32 2}
43!6 = !{i32 7, !"PIE Level", i32 2}
44!7 = !{i32 7, !"uwtable", i32 2}
45!8 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
46!9 = !{!"clang version 18.0.0"}
47!10 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !11, scopeLine: 4, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
48!11 = !DISubroutineType(types: !12)
49!12 = !{!13}
50!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
51!14 = !{!15}
52!15 = !DILocalVariable(name: "a1", scope: !10, file: !1, line: 5, type: !16)
53!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, size: 17179869176, elements: !18)
54!17 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
55!18 = !{!19}
56!19 = !DISubrange(count: 2147483647)
57!20 = !DILocation(line: 0, scope: !10)
58!21 = !DILocation(line: 7, column: 3, scope: !10)
59!22 = !DILocalVariable(name: "a2", scope: !10, file: !1, line: 5, type: !16)
60!23 = !DILocalVariable(name: "a3", scope: !10, file: !1, line: 5, type: !16)
61!24 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, size: 4294967232, elements: !18)
62!25 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, size: 4294967233, elements: !18)
63