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 @@ -2469,7 +2469,8 @@ DwarfExpr.addExpression(std::move(ExprCursor)); return; } else if (Value.isConstantFP()) { - if (AP.getDwarfVersion() >= 4 && AP.getDwarfDebug()->tuneForGDB()) { + if (AP.getDwarfVersion() >= 4 && (AP.getDwarfDebug()->tuneForGDB() || + AP.getDwarfDebug()->tuneForLLDB())) { DwarfExpr.addConstantFP(Value.getConstantFP()->getValueAPF(), AP); return; } else if (Value.getConstantFP() diff --git a/llvm/test/DebugInfo/X86/implicit_value-double.ll b/llvm/test/DebugInfo/X86/implicit_value-double.ll --- a/llvm/test/DebugInfo/X86/implicit_value-double.ll +++ b/llvm/test/DebugInfo/X86/implicit_value-double.ll @@ -9,6 +9,14 @@ ; CHECK-NEXT: [{{.*}}): DW_OP_implicit_value 0x8 0x1f 0x85 0xeb 0x51 0xb8 0x1e 0x09 0x40) ; CHECK-NEXT: DW_AT_name ("d") +; RUN: llc -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s + +; CHECK: .debug_info contents: +; CHECK: DW_TAG_variable +; CHECK-NEXT: DW_AT_location ({{.*}} +; CHECK-NEXT: [{{.*}}): DW_OP_implicit_value 0x8 0x1f 0x85 0xeb 0x51 0xb8 0x1e 0x09 0x40) +; CHECK-NEXT: DW_AT_name ("d") + ;; Generated from: clang -ggdb -O1 ;;int main() { ;; double d = 3.14; diff --git a/llvm/test/DebugInfo/X86/implicit_value-float.ll b/llvm/test/DebugInfo/X86/implicit_value-float.ll --- a/llvm/test/DebugInfo/X86/implicit_value-float.ll +++ b/llvm/test/DebugInfo/X86/implicit_value-float.ll @@ -9,6 +9,14 @@ ; CHECK-NEXT: [{{.*}}): DW_OP_implicit_value 0x4 0xc3 0xf5 0x48 0x40) ; CHECK-NEXT: DW_AT_name ("f") +; RUN: llc -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s + +; CHECK: .debug_info contents: +; CHECK: DW_TAG_variable +; CHECK-NEXT: DW_AT_location ({{.*}} +; CHECK-NEXT: [{{.*}}): DW_OP_implicit_value 0x4 0xc3 0xf5 0x48 0x40) +; CHECK-NEXT: DW_AT_name ("f") + ;; Generated from: clang -ggdb -O1 ;;int main() { ;; float f = 3.14f;