Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ void CGDebugInfo::addInstToSpecificSourceAtom(llvm::Instruction *KeyInstruction,
if (!Group || !CGM.getCodeGenOpts().DebugKeyInstructions)
return;

llvm::DISubprogram *SP = KeyInstruction->getFunction()->getSubprogram();
if (!SP || !SP->getKeyInstructionsEnabled())
return;

addInstSourceAtomMetadata(KeyInstruction, Group, /*Rank=*/1);

llvm::Instruction *BackupI =
Expand Down
13 changes: 7 additions & 6 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3185,12 +3185,6 @@ void Verifier::visitFunction(const Function &F) {
CheckDI(SP->describes(&F),
"!dbg attachment points at wrong subprogram for function", N, &F,
&I, DL, Scope, SP);

if (DL->getAtomGroup())
CheckDI(DL->getScope()->getSubprogram()->getKeyInstructionsEnabled(),
"DbgLoc uses atomGroup but DISubprogram doesn't have Key "
"Instructions enabled",
DL, DL->getScope()->getSubprogram());
};
for (auto &BB : F)
for (auto &I : BB) {
Expand Down Expand Up @@ -5492,6 +5486,13 @@ void Verifier::visitInstruction(Instruction &I) {
if (MDNode *N = I.getDebugLoc().getAsMDNode()) {
CheckDI(isa<DILocation>(N), "invalid !dbg metadata attachment", &I, N);
visitMDNode(*N, AreDebugLocsAllowed::Yes);

auto *DL = cast<DILocation>(N);
if (DL->getAtomGroup())
CheckDI(DL->getScope()->getSubprogram()->getKeyInstructionsEnabled(),
"DbgLoc uses atomGroup but DISubprogram doesn't have Key "
"Instructions enabled",
DL, DL->getScope()->getSubprogram());
}

if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) {
Expand Down
Loading