99 lines · plain
1; REQUIRES: object-emission2 3; Make sure the fake use of 'b' at the end of 'foo' causes location information for 'b'4; to extend all the way to the end of the function.5; Duplicates `DebugInfo/X86/fake-use.ll` for global-isel.6 7; RUN: %llc_dwarf -O2 --global-isel=1 -mtriple=aarch64--linux-gnu -filetype=obj -dwarf-linkage-names=Abstract < %s | llvm-dwarfdump --debug-info --debug-line -v - -o %t8; RUN: %python %p/../Inputs/check-fake-use.py %t9; RUN: sed -e 's,call void (...) @llvm.fake.use,;,' %s \10; RUN: | %llc_dwarf - -O2 --global-isel=1 -mtriple=aarch64--linux-gnu -filetype=obj -dwarf-linkage-names=Abstract \11; RUN: | llvm-dwarfdump --debug-info --debug-line -v - -o %t12; RUN: not %python %p/../Inputs/check-fake-use.py %t13 14; Generated with:15; clang -O2 -g -S -emit-llvm -fextend-variable-liveness=this fake-use.c16;17; int glob[10];18; extern void bar();19;20; int foo(int b, int i)21; {22; int loc = glob[i] * 2;23; if (b) {24; glob[2] = loc;25; bar();26; }27; return loc;28; }29;30; ModuleID = 't2.c'31source_filename = "t2.c"32 33@glob = common local_unnamed_addr global [10 x i32] zeroinitializer, align 16, !dbg !034 35; Function Attrs: nounwind sspstrong uwtable36define i32 @foo(i32 %b, i32 %i) local_unnamed_addr optdebug !dbg !13 {37entry:38 #dbg_value(i32 %b, !17, !20, !21)39 %c = add i32 %b, 4240 %tobool = icmp sgt i32 %c, 2, !dbg !2741 tail call void (...) @bar() #2, !dbg !3242 %idxprom = sext i32 %i to i64, !dbg !2243 %arrayidx = getelementptr inbounds [10 x i32], [10 x i32]* @glob, i64 0, i64 %idxprom, !dbg !2244 %0 = load i32, i32* %arrayidx, align 4, !dbg !22, !tbaa !2345 %mul = shl nsw i32 %0, 1, !dbg !2246 br i1 %tobool, label %if.end, label %if.then, !dbg !2947 48if.then: ; preds = %entry49 store i32 %mul, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @glob, i64 0, i64 2), align 8, !dbg !30, !tbaa !2350 tail call void (...) @bar() #2, !dbg !3251 br label %if.end, !dbg !3352 53if.end: ; preds = %entry, %if.then54 call void (...) @llvm.fake.use(i32 %b), !dbg !3455 ret i32 %mul, !dbg !3556}57 58declare void @bar(...) local_unnamed_addr59 60!llvm.dbg.cu = !{!1}61!llvm.module.flags = !{!9, !10, !11}62!llvm.ident = !{!12}63 64!0 = distinct !DIGlobalVariableExpression(var: !DIGlobalVariable(name: "glob", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true), expr: !DIExpression())65!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 4.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)66!2 = !DIFile(filename: "t2.c", directory: "/")67!3 = !{}68!4 = !{!0}69!5 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 320, align: 32, elements: !7)70!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)71!7 = !{!8}72!8 = !DISubrange(count: 10)73!9 = !{i32 2, !"Dwarf Version", i32 4}74!10 = !{i32 2, !"Debug Info Version", i32 3}75!11 = !{i32 1, !"PIC Level", i32 2}76!12 = !{!"clang version 4.0.0"}77!13 = distinct !DISubprogram(name: "foo", scope: !2, file: !2, line: 4, type: !14, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !1, retainedNodes: !16)78!14 = !DISubroutineType(types: !15)79!15 = !{!6, !6, !6}80!16 = !{!17, !19}81!17 = !DILocalVariable(name: "b", arg: 1, scope: !13, file: !2, line: 4, type: !6)82!19 = !DILocalVariable(name: "loc", scope: !13, file: !2, line: 6, type: !6)83!20 = !DIExpression()84!21 = !DILocation(line: 4, scope: !13)85!22 = !DILocation(line: 6, scope: !13)86!23 = !{!24, !24, i64 0}87!24 = !{!"int", !25, i64 0}88!25 = !{!"omnipotent char", !26, i64 0}89!26 = !{!"Simple C/C++ TBAA"}90!27 = !DILocation(line: 7, scope: !28)91!28 = distinct !DILexicalBlock(scope: !13, file: !2, line: 7)92!29 = !DILocation(line: 7, scope: !13)93!30 = !DILocation(line: 8, scope: !31)94!31 = distinct !DILexicalBlock(scope: !28, file: !2, line: 7)95!32 = !DILocation(line: 9, scope: !31)96!33 = !DILocation(line: 10, scope: !31)97!34 = !DILocation(line: 12, scope: !13)98!35 = !DILocation(line: 11, scope: !13)99