[PATCH] D136949: [Debugify] Accumulate the number of variables in debugify metadata
Anton Sidorenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 06:55:02 PDT 2022
asi-sc created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
asi-sc requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When a module contains more than one function, we should update debugify metadata
by increasing the number of variables in the function rather than overwritting it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D136949
Files:
llvm/lib/CodeGen/MachineDebugify.cpp
Index: llvm/lib/CodeGen/MachineDebugify.cpp
===================================================================
--- llvm/lib/CodeGen/MachineDebugify.cpp
+++ llvm/lib/CodeGen/MachineDebugify.cpp
@@ -153,10 +153,15 @@
NMD->setOperand(Idx, MDNode::get(Ctx, ValueAsMetadata::getConstant(
ConstantInt::get(Int32Ty, N))));
};
+ auto getDebugifyOperand = [&](unsigned Idx) {
+ return mdconst::extract<ConstantInt>(NMD->getOperand(Idx)->getOperand(0))
+ ->getZExtValue();
+ };
// Set number of lines.
setDebugifyOperand(0, NextLine - 1);
// Set number of variables.
- setDebugifyOperand(1, VarSet.size());
+ auto OldNumVars = getDebugifyOperand(1);
+ setDebugifyOperand(1, OldNumVars + VarSet.size());
}
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136949.471537.patch
Type: text/x-patch
Size: 822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221028/f5f97ed0/attachment.bin>
More information about the llvm-commits
mailing list