diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2474,6 +2474,10 @@ DwarfExpr.addExpression(std::move(ExprCursor)); return; } + if (Value.isConstantInt()) { + DwarfExpr.addUnsignedConstant(Value.getConstantInt()->getValue(), AP); + return; + } if (Value.isConstantFP()) { DwarfExpr.addConstantFP(Value.getConstantFP()->getValueAPF(), AP); return; diff --git a/llvm/test/DebugInfo/X86/implicit_value-int128_t.ll b/llvm/test/DebugInfo/X86/implicit_value-int128_t.ll new file mode 100644 --- /dev/null +++ b/llvm/test/DebugInfo/X86/implicit_value-int128_t.ll @@ -0,0 +1,46 @@ +; RUN: llc -debugger-tune=gdb -filetype=obj %s -o - | llvm-dwarfdump - \ +; RUN: | FileCheck %s --check-prefixes=GDB,BOTH +; RUN: llc -debugger-tune=sce -filetype=obj %s -o - | llvm-dwarfdump - \ +; RUN: | FileCheck %s --check-prefixes=SCE,BOTH + +; BOTH: DW_TAG_variable +; BOTH-NEXT: DW_AT_location +; GDB-NEXT: {{.*}}: DW_OP_implicit_value 0x10 0x0f 0x0e 0x0d 0x0c 0x0b 0x0a 0x09 0x08 0x07 0x06 0x05 0x04 0x03 0x02 0x01 0x00 +; SCE-NEXT: {{.*}}: DW_OP_constu 0x8090a0b0c0d0e0f, DW_OP_stack_value, DW_OP_piece 0x8, DW_OP_constu 0x1020304050607, DW_OP_stack_value, DW_OP_bit_piece 0x40 0x40 +; GDB-NEXT: {{.*}}: DW_OP_implicit_value 0x10 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0) +; SCE-NEXT: {{.*}}: DW_OP_constu 0x7060504030201000, DW_OP_stack_value, DW_OP_piece 0x8, DW_OP_constu 0xf0e0d0c0b0a09080, DW_OP_stack_value, DW_OP_bit_piece 0x40 0x40 +; BOTH-NEXT: DW_AT_name ("a") + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define dso_local void @f() local_unnamed_addr !dbg !7 { +entry: + call void @llvm.dbg.value(metadata i128 5233100606242806050955395731361295, metadata !12, metadata !DIExpression()), !dbg !15 + tail call void @g(), !dbg !15 + call void @llvm.dbg.value(metadata i128 320182027492359845421654932427609477120, metadata !12, metadata !DIExpression()), !dbg !15 + tail call void @g(), !dbg !15 + ret void, !dbg !15 +} + +declare dso_local void @g() local_unnamed_addr + +declare void @llvm.dbg.value(metadata, metadata, metadata) #2 + +attributes #2 = { nofree nosync nounwind readnone speculatable willreturn } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug, enums: !2) +!1 = !DIFile(filename: "-", directory: "/") +!2 = !{} +!3 = !{i32 7, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, type: !9, unit: !0) +!9 = !DISubroutineType(types: !10) +!10 = !{null} +!12 = !DILocalVariable(name: "a", scope: !7, file: !1, type: !14) +!14 = !DIBasicType(name: "__int128", size: 128, encoding: DW_ATE_signed) +!15 = !DILocation(line: 0, scope: !7)