From 8763c0c5b7a566d2fe9476259aa346640b0a9deb Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 31 Oct 2018 17:18:41 +0000 Subject: MachineModuleInfo: Initialize DbgInfoAvailable depending on debug_cus existing Before this patch DbgInfoAvailable was set to true in DwarfDebug::beginModule() or CodeViewDebug::CodeViewDebug(). This made MIR testing weird since passes would suddenly stop dealing with debug info just because we stopped the pipeline before the debug printers. This patch changes the logic to initialize DbgInfoAvailable based on the fact that debug_compile_units exist in the llvm Module. The debug printers may then override it with false in case of debug printing being disabled. Differential Revision: https://reviews.llvm.org/D53885 llvm-svn: 345740 --- llvm/lib/CodeGen/MachineModuleInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp') diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 639cd80768f..ce556903dc0 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -206,10 +206,11 @@ MachineModuleInfo::~MachineModuleInfo() = default; bool MachineModuleInfo::doInitialization(Module &M) { ObjFileMMI = nullptr; CurCallSite = 0; - DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false; + UsesVAFloatArgument = UsesMorestackAddr = false; HasSplitStack = HasNosplitStack = false; AddrLabelSymbols = nullptr; TheModule = &M; + DbgInfoAvailable = !empty(M.debug_compile_units()); return false; } -- cgit v1.2.3