1 ; RUN: opt < %s -loop-reduce -S | FileCheck %s
3 ; Test that LSR avoids crashing on very large integer inputs. It should
4 ; discard the variable location by creating an undef dbg.value.
6 ; CHECK: call void @llvm.dbg.value(metadata i128 poison,
8 source_filename = "<stdin>"
9 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-unknown-linux-gnu"
12 define dso_local void @qux() local_unnamed_addr !dbg !10 {
14 br label %for.body, !dbg !17
16 for.body: ; preds = %for.body.for.body_crit_edge, %entry
17 %0 = phi i128 [ 0, %entry ], [ %.pre8, %for.body.for.body_crit_edge ], !dbg !19
18 %add6.i.i = add i128 %0, 18446744073709551615, !dbg !35
19 call void @llvm.dbg.value(metadata i128 %add6.i.i, metadata !25, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 128)), !dbg !36
20 br label %for.body.for.body_crit_edge
22 for.body.for.body_crit_edge: ; preds = %for.body
23 %.pre8 = load i128, ptr undef, align 16, !dbg !19, !tbaa !37
24 br label %for.body, !dbg !17
27 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
28 declare void @llvm.dbg.value(metadata, metadata, metadata)
31 !llvm.module.flags = !{!7, !8, !9}
33 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2, splitDebugInlining: false, nameTableKind: None)
34 !1 = !DIFile(filename: "/tmp/beans.c", directory: "/tmp")
37 !4 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint64_t", file: !5, line: 1, baseType: !6)
38 !5 = !DIFile(filename: "/tmp/beans.c", directory: "")
39 !6 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)
40 !7 = !{i32 7, !"Dwarf Version", i32 4}
41 !8 = !{i32 2, !"Debug Info Version", i32 3}
42 !9 = !{i32 1, !"wchar_size", i32 4}
43 !10 = distinct !DISubprogram(name: "qux", scope: !5, file: !5, line: 27, type: !11, scopeLine: 27, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
44 !11 = !DISubroutineType(types: !12)
45 !12 = !{null, !13, !13}
46 !13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64)
47 !14 = !DIDerivedType(tag: DW_TAG_typedef, name: "croix", file: !5, line: 2, baseType: !15)
48 !15 = !DIDerivedType(tag: DW_TAG_typedef, name: "__uint128_t", file: !1, baseType: !16)
49 !16 = !DIBasicType(name: "unsigned __int128", size: 128, encoding: DW_ATE_unsigned)
50 !17 = !DILocation(line: 30, column: 3, scope: !18)
51 !18 = distinct !DILexicalBlock(scope: !10, file: !5, line: 30, column: 3)
52 !19 = !DILocation(line: 12, column: 25, scope: !20, inlinedAt: !30)
53 !20 = distinct !DISubprogram(name: "bar", scope: !5, file: !5, line: 8, type: !21, scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !24)
54 !21 = !DISubroutineType(types: !22)
55 !22 = !{null, !23, !13}
56 !23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64)
58 !25 = !DILocalVariable(name: "tmp", scope: !20, file: !5, line: 9, type: !26)
59 !26 = !DIDerivedType(tag: DW_TAG_typedef, name: "xyzzy", file: !5, line: 3, baseType: !27)
60 !27 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 512, elements: !28)
62 !29 = !DISubrange(count: 4)
63 !30 = distinct !DILocation(line: 23, column: 3, scope: !31, inlinedAt: !32)
64 !31 = distinct !DISubprogram(name: "baz", scope: !5, file: !5, line: 21, type: !11, scopeLine: 21, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
65 !32 = distinct !DILocation(line: 31, column: 5, scope: !33)
66 !33 = distinct !DILexicalBlock(scope: !34, file: !5, line: 30, column: 31)
67 !34 = distinct !DILexicalBlock(scope: !18, file: !5, line: 30, column: 3)
68 !35 = !DILocation(line: 12, column: 23, scope: !20, inlinedAt: !30)
69 !36 = !DILocation(line: 0, scope: !20, inlinedAt: !30)
70 !37 = !{!38, !38, i64 0}
71 !38 = !{!"__int128", !39, i64 0}
72 !39 = !{!"omnipotent char", !40, i64 0}
73 !40 = !{!"Simple C/C++ TBAA"}