brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 23f4084 Raw
68 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=mem2reg -S | FileCheck %s3 4; Testing conversion from dbg.declare to dbg.value when the variable is a VLA.5;6; We can't derive the size of the variable simply by looking at the7; metadata. But we can find out the size by examining the alloca, so we should8; know that the load/store instructions are referencing the whole variable,9; and we expect to get dbg.value intrinsics that maps %entryN (aka %[[PHI]])10; and %t0 to the variable allocated as %vla1.11 12; ModuleID = 'debug-alloca-vla.ll'13target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"14target triple = "x86_64-apple-macosx10.12.0"15 16; Function Attrs: nounwind ssp uwtable17define void @scan() #0 !dbg !4 {18; CHECK-LABEL: @scan(19; CHECK-NEXT:  entry:20; CHECK-NEXT:    br label [[FOR_COND:%.*]], !dbg [[DBG10:![0-9]+]]21; CHECK:       for.cond:22; CHECK-NEXT:    [[VLA1_0:%.*]] = phi i32 [ undef, [[ENTRY:%.*]] ], [ [[T0:%.*]], [[FOR_COND]] ]23; CHECK-NEXT:      #dbg_value(i32 [[VLA1_0]], [[META11:![0-9]+]], !DIExpression(), [[META19:![0-9]+]])24; CHECK-NEXT:    [[T0]] = add i32 [[VLA1_0]], 125; CHECK-NEXT:      #dbg_value(i32 [[T0]], [[META11]], !DIExpression(), [[META19]])26; CHECK-NEXT:    br label [[FOR_COND]], !dbg [[DBG10]]27;28entry:29  %vla1 = alloca i32, i32 1, align 830  call void @llvm.dbg.declare(metadata ptr %vla1, metadata !10, metadata !DIExpression()), !dbg !1831  br label %for.cond, !dbg !1832 33for.cond:                                         ; preds = %for.cond, %entry34  %entryN = load i32, ptr %vla1, align 8, !dbg !1835  %t0 = add i32 %entryN, 136  store i32 %t0, ptr %vla1, align 8, !dbg !1837  br label %for.cond, !dbg !1838}39 40; Function Attrs: nounwind readnone speculatable41declare void @llvm.dbg.declare(metadata, metadata, metadata) #142 43attributes #0 = { nounwind ssp uwtable }44attributes #1 = { nounwind readnone speculatable }45 46!llvm.dbg.cu = !{!0}47!llvm.module.flags = !{!2, !3}48 49!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)50!1 = !DIFile(filename: "<stdin>", directory: "/")51!2 = !{i32 2, !"Debug Info Version", i32 3}52!3 = !{i32 7, !"PIC Level", i32 2}53!4 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8)54!5 = !DISubroutineType(types: !6)55!6 = !{null, !7, !7}56!7 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)57!8 = !{!9}58!9 = !DILocalVariable(name: "entry", scope: !4, file: !1, line: 6, type: !7)59!10 = !DILocalVariable(name: "ptr32", scope: !4, file: !1, line: 240, type: !11)60!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !12, elements: !14)61!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "__uint32_t", file: !1, line: 41, baseType: !13)62!13 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)63!14 = !{!15}64!15 = !DISubrange(count: !16)65!16 = !DILocalVariable(name: "__vla_expr", scope: !4, type: !17, flags: DIFlagArtificial)66!17 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)67!18 = !DILocation(line: 6, scope: !4)68