Page MenuHomePhabricator

MachineModuleInfo: Initialize DbgInfoAvailable depending on debug_cus existing
ClosedPublic

Authored by MatzeB on Oct 30 2018, 1:22 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB created this revision.Oct 30 2018, 1:22 PM

Sounds like this could have a test case, if it's meant to facilitate easier testing?

lib/CodeGen/MachineModuleInfo.cpp
214 ↗(On Diff #171770)

maybe:

empty(M.debug_compile_units());

(we should have/add an llvm::empty(Range) template somewhere in STLExtras or the like, I think - that compares begin/end - maybe it should be called is_empty, I guess, to clarify that it isn't mutating a container... )

MatzeB updated this revision to Diff 171851.Oct 30 2018, 5:56 PM
dblaikie accepted this revision.Oct 31 2018, 10:14 AM
dblaikie added inline comments.
test/CodeGen/AArch64/fast-isel-dbg.ll
6–18 ↗(On Diff #171851)

Probably put this metadata after the rest of the code, as it's usually printed (this also has the effect of moving the CHECKs (and the original dbg.declare in question) up closer to the RUN lines, so it's a bit easier to see how all the testing is related

This revision is now accepted and ready to land.Oct 31 2018, 10:14 AM
This revision was automatically updated to reflect the committed changes.