[PATCH] D31720: [StripDeadDebugInfo] Drop dead CUs entirely

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 15:29:51 PDT 2017


aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Can you add a CU that only has a DIGlobalVariableExpression with a DIExpression(DW_OP_constu 0, DW_OP_stack_value) to your testcase and verify that it survives?
Otherwise this LGTM.



================
Comment at: lib/Transforms/IPO/StripSymbols.cpp:327
+  std::set<DICompileUnit *> LiveCUs;
+  // Any CU referenced from a function is live
+  for (Function &F : M.functions()) {
----------------
`.` at the end :-)


================
Comment at: lib/Transforms/IPO/StripSymbols.cpp:353
 
+    if (!LiveGlobalVariables.empty()) {
+      LiveCUs.insert(DIC);
----------------
remove extra parens?


================
Comment at: lib/Transforms/IPO/StripSymbols.cpp:373
+    NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
+    NMD->eraseFromParent();
+    if (!LiveCUs.empty()) {
----------------
It might be faster to just call clearOperands() instead of deleting the entire node?


https://reviews.llvm.org/D31720





More information about the llvm-commits mailing list