-
Notifications
You must be signed in to change notification settings - Fork 14.3k
DebugInfo: Avoid some MMI::hasDebugInfo checks #100333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-selectiondag @llvm/pr-subscribers-backend-x86 Author: Matt Arsenault (arsenm) ChangesI assume getSubprogram will do the correct thing in hasDebugInfo, Full diff: https://github.com/llvm/llvm-project/pull/100333.diff 2 Files Affected:
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
index 6c70c47de8822..ed99eb3c459e5 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -241,10 +241,7 @@ bool DebugHandlerBase::isUnsignedDIType(const DIType *Ty) {
Ty->getTag() == dwarf::DW_TAG_unspecified_type;
}
-static bool hasDebugInfo(const MachineModuleInfo *MMI,
- const MachineFunction *MF) {
- if (!MMI->hasDebugInfo())
- return false;
+static bool hasDebugInfo(const MachineFunction *MF) {
auto *SP = MF->getFunction().getSubprogram();
if (!SP)
return false;
@@ -258,7 +255,7 @@ static bool hasDebugInfo(const MachineModuleInfo *MMI,
void DebugHandlerBase::beginFunction(const MachineFunction *MF) {
PrevInstBB = nullptr;
- if (!Asm || !hasDebugInfo(MMI, MF)) {
+ if (!Asm || !hasDebugInfo(MF)) {
skippedNonDebugFunction();
return;
}
@@ -415,7 +412,7 @@ void DebugHandlerBase::endInstruction() {
}
void DebugHandlerBase::endFunction(const MachineFunction *MF) {
- if (Asm && hasDebugInfo(MMI, MF))
+ if (Asm && hasDebugInfo(MF))
endFunctionImpl(MF);
DbgValues.clear();
DbgLabels.clear();
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 5f1f315c5ab24..fbce7e92b7781 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1148,14 +1148,15 @@ sortGlobalExprs(SmallVectorImpl<DwarfCompileUnit::GlobalExpr> &GVEs) {
void DwarfDebug::beginModule(Module *M) {
DebugHandlerBase::beginModule(M);
- if (!Asm || !MMI->hasDebugInfo())
+ if (!Asm)
return;
unsigned NumDebugCUs = std::distance(M->debug_compile_units_begin(),
M->debug_compile_units_end());
+ if (NumDebugCUs == 0)
+ return;
+
assert(NumDebugCUs > 0 && "Asm unexpectedly initialized");
- assert(MMI->hasDebugInfo() &&
- "DebugInfoAvailabilty unexpectedly not initialized");
SingleCU = NumDebugCUs == 1;
DenseMap<DIGlobalVariable *, SmallVector<DwarfCompileUnit::GlobalExpr, 1>>
GVMap;
|
df45fdf
to
752f021
Compare
cdc7ef3
to
442532e
Compare
752f021
to
a0ea675
Compare
442532e
to
1e3fdb2
Compare
1e3fdb2
to
6367409
Compare
a0ea675
to
167cea6
Compare
6367409
to
47fbdca
Compare
167cea6
to
6f82349
Compare
47fbdca
to
0d0fe00
Compare
6f82349
to
50c0a81
Compare
0d0fe00
to
f3cbd76
Compare
0df69b8
to
4f683ee
Compare
f3cbd76
to
9f6b09e
Compare
return; | ||
|
||
unsigned NumDebugCUs = std::distance(M->debug_compile_units_begin(), | ||
M->debug_compile_units_end()); | ||
if (NumDebugCUs == 0) | ||
return; | ||
|
||
assert(NumDebugCUs > 0 && "Asm unexpectedly initialized"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant with the above check.
2844209
to
0db6ff6
Compare
I assume getSubprogram will do the correct thing in hasDebugInfo, and this is redundant with the debug_compile_units distance check. This is in preparation for removing the field.
9f6b09e
to
0f250dc
Compare
I assume getSubprogram will do the correct thing in hasDebugInfo,
and this is redundant with the debug_compile_units distance check.
This is in preparation for removing the field.