brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · e59da9f Raw
85 lines · plain
1; RUN: opt < %s -loop-reduce -S | FileCheck %s2 3; Test that LSR does not produce invalid debug info when a debug value is4; salvaged during LSR by adding additional location operands, then becomes5; undef, and finally recovered by SCEV salvaging.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 i32 @_Z3fooiii(i32 %Result, i32 %Step, i32 %Last) local_unnamed_addr !dbg !7 {10; CHECK-LABEL: @_Z3fooiii(11entry:12  call void @llvm.dbg.value(metadata i32 %Result, metadata !12, metadata !DIExpression()), !dbg !1713  call void @llvm.dbg.value(metadata i32 %Step, metadata !13, metadata !DIExpression()), !dbg !1714  call void @llvm.dbg.value(metadata i32 %Last, metadata !14, metadata !DIExpression()), !dbg !1715  call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !DIExpression()), !dbg !1716  br label %do.body, !dbg !1817 18do.body:                                          ; preds = %do.body, %entry19; CHECK-LABEL: do.body: 20  %Result.addr.0 = phi i32 [ %Result, %entry ], [ %or, %do.body ]21  %Itr.0 = phi i32 [ 0, %entry ], [ %add, %do.body ], !dbg !1722; CHECK-NOT: #dbg_value(!DIArgList23; CHECK: #dbg_value(!DIArgList(i32 %lsr.iv, i32 %Step), ![[VAR_ITR:[0-9]+]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus, DW_OP_LLVM_arg, 1, DW_OP_div, DW_OP_LLVM_arg, 1, DW_OP_mul, DW_OP_stack_value),24  call void @llvm.dbg.value(metadata i32 %Itr.0, metadata !16, metadata !DIExpression()), !dbg !1725  call void @llvm.dbg.value(metadata i32 %Result.addr.0, metadata !12, metadata !DIExpression()), !dbg !1726  %add = add nsw i32 %Itr.0, %Step, !dbg !1927  call void @llvm.dbg.value(metadata i32 %add, metadata !16, metadata !DIExpression()), !dbg !1728  %call = tail call i32 @_Z3barv(), !dbg !2129  call void @llvm.dbg.value(metadata i32 %call, metadata !15, metadata !DIExpression()), !dbg !1730  %shl = shl i32 %call, %add, !dbg !2231  %or = or i32 %shl, %Result.addr.0, !dbg !2332  call void @llvm.dbg.value(metadata i32 %or, metadata !12, metadata !DIExpression()), !dbg !1733  %and = and i32 %call, %Last, !dbg !2434  %tobool.not = icmp eq i32 %and, 0, !dbg !2535  br i1 %tobool.not, label %do.end, label %do.body, !dbg !26, !llvm.loop !2736 37do.end:                                           ; preds = %do.body38  ret i32 %or, !dbg !3039}40 41declare !dbg !31 dso_local i32 @_Z3barv() local_unnamed_addr42 43declare void @llvm.dbg.value(metadata, metadata, metadata)44 45; CHECK: ![[VAR_ITR]] = !DILocalVariable(name: "Itr"46 47!llvm.dbg.cu = !{!0}48!llvm.module.flags = !{!3, !4, !5}49!llvm.ident = !{!6}50 51!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)52!1 = !DIFile(filename: "test.cpp", directory: "/")53!2 = !{}54!3 = !{i32 7, !"Dwarf Version", i32 4}55!4 = !{i32 2, !"Debug Info Version", i32 3}56!5 = !{i32 1, !"wchar_size", i32 4}57!6 = !{!"clang version 13.0.0"}58!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooiii", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)59!8 = !DISubroutineType(types: !9)60!9 = !{!10, !10, !10, !10}61!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)62!11 = !{!12, !13, !14, !15, !16}63!12 = !DILocalVariable(name: "Result", arg: 1, scope: !7, file: !1, line: 3, type: !10)64!13 = !DILocalVariable(name: "Step", arg: 2, scope: !7, file: !1, line: 3, type: !10)65!14 = !DILocalVariable(name: "Last", arg: 3, scope: !7, file: !1, line: 3, type: !10)66!15 = !DILocalVariable(name: "Bar", scope: !7, file: !1, line: 4, type: !10)67!16 = !DILocalVariable(name: "Itr", scope: !7, file: !1, line: 5, type: !10)68!17 = !DILocation(line: 0, scope: !7)69!18 = !DILocation(line: 6, column: 3, scope: !7)70!19 = !DILocation(line: 7, column: 9, scope: !20)71!20 = distinct !DILexicalBlock(scope: !7, file: !1, line: 6, column: 6)72!21 = !DILocation(line: 8, column: 11, scope: !20)73!22 = !DILocation(line: 9, column: 20, scope: !20)74!23 = !DILocation(line: 9, column: 12, scope: !20)75!24 = !DILocation(line: 10, column: 16, scope: !7)76!25 = !DILocation(line: 10, column: 12, scope: !7)77!26 = !DILocation(line: 10, column: 3, scope: !20)78!27 = distinct !{!27, !18, !28, !29}79!28 = !DILocation(line: 10, column: 22, scope: !7)80!29 = !{!"llvm.loop.mustprogress"}81!30 = !DILocation(line: 11, column: 3, scope: !7)82!31 = !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 1, type: !32, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)83!32 = !DISubroutineType(types: !33)84!33 = !{!10}85