xref: /llvm-project/llvm/test/DebugInfo/X86/dbg-const.ll (revision 2c864551df3945f50e1780b2f2c880ec358ae715)
163eaed03SEric Christopher; RUN: llc < %s - | FileCheck %s
263eaed03SEric Christopher;
363eaed03SEric Christopher; FIXME: A potentially more interesting test case would be:
463eaed03SEric Christopher; %call = @bar()
563eaed03SEric Christopher; dbg.value j=0
663eaed03SEric Christopher; %call2 = @bar()
763eaed03SEric Christopher; dbg.value j=%call
863eaed03SEric Christopher;
963eaed03SEric Christopher; We cannot current handle the above sequence because codegenprepare
1063eaed03SEric Christopher; hoists the second dbg.value above %call2, which then appears to
1163eaed03SEric Christopher; conflict with j=0. It does this because SelectionDAG cannot handle
1263eaed03SEric Christopher; global debug values.
1363eaed03SEric Christopher
1463eaed03SEric Christophertarget triple = "x86_64-apple-darwin10.0.0"
1563eaed03SEric Christopher
163bdcb52dSAdrian Prantl;CHECK:        ## DW_OP_consts
1763eaed03SEric Christopher;CHECK-NEXT:  .byte	42
18d4bff303SPeter Collingbournedefine i32 @foobar() nounwind readonly noinline ssp !dbg !0 {
1963eaed03SEric Christopherentry:
20abe04759SAdrian Prantl  tail call void @llvm.dbg.value(metadata i32 42, metadata !6, metadata !DIExpression()), !dbg !9
2163eaed03SEric Christopher  %call = tail call i32 @bar(), !dbg !11
22abe04759SAdrian Prantl  tail call void @llvm.dbg.value(metadata i32 %call, metadata !6, metadata !DIExpression()), !dbg !11
2363eaed03SEric Christopher  %call2 = tail call i32 @bar(), !dbg !11
2463eaed03SEric Christopher  %add = add nsw i32 %call2, %call, !dbg !12
2563eaed03SEric Christopher  ret i32 %add, !dbg !10
2663eaed03SEric Christopher}
2763eaed03SEric Christopher
28abe04759SAdrian Prantldeclare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone
2963eaed03SEric Christopherdeclare i32 @bar() nounwind readnone
3063eaed03SEric Christopher
3163eaed03SEric Christopher!llvm.dbg.cu = !{!2}
32409558f8SManman Ren!llvm.module.flags = !{!17}
3363eaed03SEric Christopher
34*2c864551SShiva Chen!0 = distinct !DISubprogram(name: "foobar", linkageName: "foobar", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2, file: !15, scope: !1, type: !3, retainedNodes: !14)
35a9308c49SDuncan P. N. Exon Smith!1 = !DIFile(filename: "mu.c", directory: "/private/tmp")
3675819aedSAdrian Prantl!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 114183)", isOptimized: true, emissionKind: FullDebug, file: !15, enums: !16, retainedTypes: !16, imports:  null)
37a9308c49SDuncan P. N. Exon Smith!3 = !DISubroutineType(types: !4)
38be7ea19bSDuncan P. N. Exon Smith!4 = !{!5}
39a9308c49SDuncan P. N. Exon Smith!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
40ed013cd2SDuncan P. N. Exon Smith!6 = !DILocalVariable(name: "j", line: 15, scope: !7, file: !1, type: !5)
41a9308c49SDuncan P. N. Exon Smith!7 = distinct !DILexicalBlock(line: 12, column: 52, file: !15, scope: !0)
42be7ea19bSDuncan P. N. Exon Smith!8 = !{i32 42}
43a9308c49SDuncan P. N. Exon Smith!9 = !DILocation(line: 15, column: 12, scope: !7)
44a9308c49SDuncan P. N. Exon Smith!10 = !DILocation(line: 23, column: 3, scope: !7)
45a9308c49SDuncan P. N. Exon Smith!11 = !DILocation(line: 17, column: 3, scope: !7)
46a9308c49SDuncan P. N. Exon Smith!12 = !DILocation(line: 18, column: 3, scope: !7)
47be7ea19bSDuncan P. N. Exon Smith!14 = !{!6}
48a9308c49SDuncan P. N. Exon Smith!15 = !DIFile(filename: "mu.c", directory: "/private/tmp")
49988a7f8bSDuncan P. N. Exon Smith!16 = !{}
50e274180fSDuncan P. N. Exon Smith!17 = !{i32 1, !"Debug Info Version", i32 3}
51