Index: clang/include/clang/Basic/CodeGenOptions.def =================================================================== --- clang/include/clang/Basic/CodeGenOptions.def +++ clang/include/clang/Basic/CodeGenOptions.def @@ -68,8 +68,7 @@ CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new ///< pass manager. CODEGENOPT(DisableRedZone , 1, 0) ///< Set when -mno-red-zone is enabled. -CODEGENOPT(EmitCallSiteInfo, 1, 0) ///< Emit call site info only in the case of - ///< '-g' + 'O>0' level. +CODEGENOPT(EmitCallSiteInfo, 1, 0) ///< Emit call site info. CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs ///< is specified. CODEGENOPT(DisableTailCalls , 1, 0) ///< Do not emit tail calls. Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -1642,7 +1642,7 @@ llvm::Triple::arm, llvm::Triple::armeb, llvm::Triple::mips, llvm::Triple::mipsel, llvm::Triple::mips64, llvm::Triple::mips64el}; - if (Opts.OptimizationLevel > 0 && Opts.hasReducedDebugInfo() && + if (Opts.hasReducedDebugInfo() && llvm::is_contained(DebugEntryValueArchs, T.getArch())) Opts.EmitCallSiteInfo = true; Index: llvm/include/llvm/Target/TargetOptions.h =================================================================== --- llvm/include/llvm/Target/TargetOptions.h +++ llvm/include/llvm/Target/TargetOptions.h @@ -302,8 +302,8 @@ std::shared_ptr BBSectionsFuncListBuf; /// The flag enables call site info production. It is used only for debug - /// info, and it is restricted only to optimized code. This can be used for - /// something else, so that should be controlled in the frontend. + /// info. This can be used for something else, so that should be controlled + /// in the frontend. unsigned EmitCallSiteInfo : 1; /// Set if the target supports the debug entry values by default. unsigned SupportsDebugEntryValues : 1; Index: llvm/test/DebugInfo/X86/callsitepar-fastisel.ll =================================================================== --- llvm/test/DebugInfo/X86/callsitepar-fastisel.ll +++ llvm/test/DebugInfo/X86/callsitepar-fastisel.ll @@ -9,6 +9,17 @@ ;CHECK: DW_AT_location (DW_OP_reg4 RSI) ;CHECK: DW_AT_GNU_call_site_value +;; This test checks if DW_TAG_GNU_call_site_parameter is generated for option -O0 +;RUN: clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -main-file-name %s -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -O0 -x ir %s -o - | llvm-dwarfdump - | FileCheck %s --check-prefix=CLANG + +;CLANG: DW_TAG_GNU_call_site +;CLANG: DW_AT_abstract_origin +;CLANG-SAME: "foo" +;CLANG: DW_AT_low_pc +;CLANG: DW_TAG_GNU_call_site_parameter +;CLANG: DW_AT_location (DW_OP_reg4 RSI) +;CLANG: DW_AT_GNU_call_site_value + ;;The IR is generated from below source program ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;subroutine foo (array)