brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · 3ff5a26 Raw
110 lines · plain
1; RUN: llc -mtriple x86_64-pc-linux -O0 < %s | FileCheck %s2 3; Make sure that the sequence of debug locations for function foo is correctly4; generated. More specifically, .loc entries for lines 4,5,6,7 must appear in5; the correct sequence.6 7; $ clang -emit-llvm -S -g dbg-combine.c8; 1.  int foo()9; 2.  {10; 3.     int elems = 3;11; 4.     int array1[elems];12; 5.     array1[0]=0;13; 6.     array1[1]=1;14; 7.     array1[2]=2;15; 8.     int array2[elems];16; 9.     array2[0]=1;17; 10.    return array2[0];18; 11. }19 20; CHECK: .loc    1 421; CHECK: .loc    1 522; CHECK: .loc    1 623; CHECK: .loc    1 724 25; ModuleID = 'dbg-combine.c'26; Function Attrs: nounwind uwtable27define i32 @foo() #0 !dbg !4 {28entry:29  %elems = alloca i32, align 430  %saved_stack = alloca ptr31  %cleanup.dest.slot = alloca i3232  call void @llvm.dbg.declare(metadata ptr %elems, metadata !12, metadata !13), !dbg !1433  store i32 3, ptr %elems, align 4, !dbg !1434  %0 = load i32, ptr %elems, align 4, !dbg !1535  %1 = zext i32 %0 to i64, !dbg !1636  %2 = call ptr @llvm.stacksave(), !dbg !1637  store ptr %2, ptr %saved_stack, !dbg !1638  %vla = alloca i32, i64 %1, align 16, !dbg !1639  call void @llvm.dbg.declare(metadata ptr %vla, metadata !17, metadata !21), !dbg !2240  store i32 0, ptr %vla, align 4, !dbg !2441  %arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 1, !dbg !2542  store i32 1, ptr %arrayidx1, align 4, !dbg !2643  %arrayidx2 = getelementptr inbounds i32, ptr %vla, i64 2, !dbg !2744  store i32 2, ptr %arrayidx2, align 4, !dbg !2845  %3 = load i32, ptr %elems, align 4, !dbg !2946  %4 = zext i32 %3 to i64, !dbg !3047  %vla3 = alloca i32, i64 %4, align 16, !dbg !3048  call void @llvm.dbg.declare(metadata ptr %vla3, metadata !31, metadata !21), !dbg !3249  store i32 1, ptr %vla3, align 4, !dbg !3450  %5 = load i32, ptr %vla3, align 4, !dbg !3551  store i32 1, ptr %cleanup.dest.slot52  %6 = load ptr, ptr %saved_stack, !dbg !3653  call void @llvm.stackrestore(ptr %6), !dbg !3654  ret i32 %5, !dbg !3655}56 57; Function Attrs: nounwind readnone58declare void @llvm.dbg.declare(metadata, metadata, metadata) #159 60; Function Attrs: nounwind61declare ptr @llvm.stacksave() #262 63; Function Attrs: nounwind64declare void @llvm.stackrestore(ptr) #265 66attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }67attributes #1 = { nounwind readnone }68attributes #2 = { nounwind }69 70!llvm.dbg.cu = !{!0}71!llvm.module.flags = !{!9, !10}72!llvm.ident = !{!11}73 74!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.7.0 (trunk 227074)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)75!1 = !DIFile(filename: "dbg-combine.c", directory: "/home/probinson/projects/scratch")76!2 = !{}77!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2)78!5 = !DIFile(filename: "dbg-combine.c", directory: "/home/probinson/projects/scratch")79!6 = !DISubroutineType(types: !7)80!7 = !{!8}81!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)82!9 = !{i32 2, !"Dwarf Version", i32 4}83!10 = !{i32 2, !"Debug Info Version", i32 3}84!11 = !{!"clang version 3.7.0 (trunk 227074)"}85!12 = !DILocalVariable(name: "elems", line: 3, scope: !4, file: !5, type: !8)86!13 = !DIExpression()87!14 = !DILocation(line: 3, column: 8, scope: !4)88!15 = !DILocation(line: 4, column: 15, scope: !4)89!16 = !DILocation(line: 4, column: 4, scope: !4)90!17 = !DILocalVariable(name: "array1", line: 4, scope: !4, file: !5, type: !18)91!18 = !DICompositeType(tag: DW_TAG_array_type, align: 32, baseType: !8, elements: !19)92!19 = !{!20}93!20 = !DISubrange(count: -1)94!21 = !DIExpression(DW_OP_deref)95!22 = !DILocation(line: 4, column: 8, scope: !4)96!23 = !DILocation(line: 5, column: 4, scope: !4)97!24 = !DILocation(line: 5, column: 13, scope: !4)98!25 = !DILocation(line: 6, column: 4, scope: !4)99!26 = !DILocation(line: 6, column: 13, scope: !4)100!27 = !DILocation(line: 7, column: 4, scope: !4)101!28 = !DILocation(line: 7, column: 13, scope: !4)102!29 = !DILocation(line: 8, column: 15, scope: !4)103!30 = !DILocation(line: 8, column: 4, scope: !4)104!31 = !DILocalVariable(name: "array2", line: 8, scope: !4, file: !5, type: !18)105!32 = !DILocation(line: 8, column: 8, scope: !4)106!33 = !DILocation(line: 9, column: 4, scope: !4)107!34 = !DILocation(line: 9, column: 13, scope: !4)108!35 = !DILocation(line: 10, column: 11, scope: !4)109!36 = !DILocation(line: 11, column: 1, scope: !4)110