Skip to content

Commit ff6ee73

Browse files
committed
fix for coro-dwarf-key-instrs.cpp
1 parent 9eb0fc8 commit ff6ee73

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ void CGDebugInfo::addInstToSpecificSourceAtom(llvm::Instruction *KeyInstruction,
170170
if (!Group || !CGM.getCodeGenOpts().DebugKeyInstructions)
171171
return;
172172

173+
llvm::DISubprogram *SP = KeyInstruction->getFunction()->getSubprogram();
174+
if (!SP || !SP->getKeyInstructionsEnabled())
175+
return;
176+
173177
addInstSourceAtomMetadata(KeyInstruction, Group, /*Rank=*/1);
174178

175179
llvm::Instruction *BackupI =

llvm/lib/IR/Verifier.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,12 +3185,6 @@ void Verifier::visitFunction(const Function &F) {
31853185
CheckDI(SP->describes(&F),
31863186
"!dbg attachment points at wrong subprogram for function", N, &F,
31873187
&I, DL, Scope, SP);
3188-
3189-
if (DL->getAtomGroup())
3190-
CheckDI(DL->getScope()->getSubprogram()->getKeyInstructionsEnabled(),
3191-
"DbgLoc uses atomGroup but DISubprogram doesn't have Key "
3192-
"Instructions enabled",
3193-
DL, DL->getScope()->getSubprogram());
31943188
};
31953189
for (auto &BB : F)
31963190
for (auto &I : BB) {
@@ -5492,6 +5486,13 @@ void Verifier::visitInstruction(Instruction &I) {
54925486
if (MDNode *N = I.getDebugLoc().getAsMDNode()) {
54935487
CheckDI(isa<DILocation>(N), "invalid !dbg metadata attachment", &I, N);
54945488
visitMDNode(*N, AreDebugLocsAllowed::Yes);
5489+
5490+
auto *DL = cast<DILocation>(N);
5491+
if (DL->getAtomGroup())
5492+
CheckDI(DL->getScope()->getSubprogram()->getKeyInstructionsEnabled(),
5493+
"DbgLoc uses atomGroup but DISubprogram doesn't have Key "
5494+
"Instructions enabled",
5495+
DL, DL->getScope()->getSubprogram());
54955496
}
54965497

54975498
if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) {

0 commit comments

Comments
 (0)