brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 83d12e4 Raw
77 lines · plain
1; RUN: opt -loop-reduce -S %s | FileCheck %s2 3;; Test that LSR preserves debug-info for induction variables and scev-based4;; salvaging produces short DIExpressions that use a constant offset from the5;; induction variable.6 7target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"8 9define dso_local void @foo(ptr nocapture %p) local_unnamed_addr !dbg !7 {10; CHECK-LABEL: @foo(11entry:12  call void @llvm.dbg.value(metadata ptr %p, metadata !13, metadata !DIExpression()), !dbg !1613  call void @llvm.dbg.value(metadata i8 0, metadata !14, metadata !DIExpression()), !dbg !1714  br label %for.body, !dbg !1815 16for.cond.cleanup:                                 ; preds = %for.body17  ret void, !dbg !1918 19for.body:                                         ; preds = %entry, %for.body20; CHECK-LABEL: for.body:21  %i.06 = phi i8 [ 0, %entry ], [ %inc, %for.body ]22  %p.addr.05 = phi ptr [ %p, %entry ], [ %add.ptr, %for.body ]23  call void @llvm.dbg.value(metadata i8 %i.06, metadata !14, metadata !DIExpression()), !dbg !1724  call void @llvm.dbg.value(metadata ptr %p.addr.05, metadata !13, metadata !DIExpression()), !dbg !1625; CHECK-NOT: #dbg_value(ptr undef26; CHECK: #dbg_value(ptr %lsr.iv, ![[MID_p:[0-9]+]],  !DIExpression(DW_OP_constu, 3, DW_OP_minus, DW_OP_stack_value),27  %add.ptr = getelementptr inbounds i8, ptr %p.addr.05, i64 3, !dbg !2028  call void @llvm.dbg.value(metadata ptr %add.ptr, metadata !13, metadata !DIExpression()), !dbg !1629; CHECK-NOT: #dbg_value(ptr undef30; CHECK: #dbg_value(ptr %lsr.iv, ![[MID_p]], !DIExpression(),31  store i8 %i.06, ptr %add.ptr, align 1, !dbg !23, !tbaa !2432  %inc = add nuw nsw i8 %i.06, 1, !dbg !2733  call void @llvm.dbg.value(metadata i8 %inc, metadata !14, metadata !DIExpression()), !dbg !1734  %exitcond.not = icmp eq i8 %inc, 32, !dbg !2835  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !dbg !18, !llvm.loop !2936}37 38declare void @llvm.dbg.value(metadata, metadata, metadata)39 40!llvm.dbg.cu = !{!0}41!llvm.module.flags = !{!3, !4, !5}42!llvm.ident = !{!6}43 44!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)45!1 = !DIFile(filename: "lsrdbg.c", directory: "/")46!2 = !{}47!3 = !{i32 7, !"Dwarf Version", i32 4}48!4 = !{i32 2, !"Debug Info Version", i32 3}49!5 = !{i32 1, !"wchar_size", i32 4}50!6 = !{!"clang version 12.0.0"}51!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)52!8 = !DISubroutineType(types: !9)53!9 = !{null, !10}54!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)55!11 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char)56!12 = !{!13, !14}57!13 = !DILocalVariable(name: "p", arg: 1, scope: !7, file: !1, line: 2, type: !10)58; CHECK: ![[MID_p]] = !DILocalVariable(name: "p", arg: 1, scope: !7, file: !1, line: 2, type: !10)59!14 = !DILocalVariable(name: "i", scope: !15, file: !1, line: 4, type: !11)60!15 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 3)61!16 = !DILocation(line: 0, scope: !7)62!17 = !DILocation(line: 0, scope: !15)63!18 = !DILocation(line: 4, column: 3, scope: !15)64!19 = !DILocation(line: 8, column: 1, scope: !7)65!20 = !DILocation(line: 5, column: 7, scope: !21)66!21 = distinct !DILexicalBlock(scope: !22, file: !1, line: 4, column: 42)67!22 = distinct !DILexicalBlock(scope: !15, file: !1, line: 4, column: 3)68!23 = !DILocation(line: 6, column: 8, scope: !21)69!24 = !{!25, !25, i64 0}70!25 = !{!"omnipotent char", !26, i64 0}71!26 = !{!"Simple C/C++ TBAA"}72!27 = !DILocation(line: 4, column: 38, scope: !22)73!28 = !DILocation(line: 4, column: 31, scope: !22)74!29 = distinct !{!29, !18, !30, !31}75!30 = !DILocation(line: 7, column: 3, scope: !15)76!31 = !{!"llvm.loop.unroll.disable"}77