[PATCH] D136949: [Debugify] Accumulate the number of variables in debugify metadata
Anton Sidorenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 24 07:50:14 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa1bbe8a4e2e5: [Debugify] Accumulate the number of variables in debugify metadata (authored by asi-sc).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136949/new/
https://reviews.llvm.org/D136949
Files:
llvm/lib/CodeGen/MachineDebugify.cpp
llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir
Index: llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir
===================================================================
--- llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir
+++ llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir
@@ -1,6 +1,7 @@
-# RUN: llc -run-pass=mir-debugify,mir-check-debugify %s
+# RUN: llc -run-pass=mir-debugify,mir-check-debugify -o - %s 2>&1 | FileCheck %s
-# XFAIL: *
+# CHECK: Machine IR debug info check: PASS
+# CHECK-NOT: Assertion `Var <= NumVars && "Unexpected name for DILocalVariable"'
--- |
define i32 @foo(i32 %a0, i32 %a1, i32 %a2, i32 %a3) {
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;
@@ -166,6 +171,9 @@
/// legacy module pass manager.
struct DebugifyMachineModule : public ModulePass {
bool runOnModule(Module &M) override {
+ // We will insert new debugify metadata, so erasing the old one.
+ assert(!M.getNamedMetadata("llvm.mir.debugify") &&
+ "llvm.mir.debugify metadata already exists! Strip it first");
MachineModuleInfo &MMI =
getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
return applyDebugifyMetadata(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136949.477795.patch
Type: text/x-patch
Size: 1930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221124/edd08800/attachment.bin>
More information about the llvm-commits
mailing list