[PATCH] D14043: [bugpoint] Add a named metadata (+their operands) reducer

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 18:03:20 PST 2015


reames added a subscriber: reames.
reames added a comment.

Test cases?


================
Comment at: tools/bugpoint/CrashDebugger.cpp:530
@@ +529,3 @@
+  ValueToValueMapTy VMap;
+  Module *M = CloneModule(BD.getProgram(), VMap);
+
----------------
Please use a shared_ptr or something.  Raw pointers should be avoided.

================
Comment at: tools/bugpoint/CrashDebugger.cpp:533
@@ +532,3 @@
+  outs() << "Checking for crash with only these named metadata nodes:";
+  unsigned NumPrint = NamedMDs.size();
+  if (NumPrint > 10)
----------------
min(10, size)

================
Comment at: tools/bugpoint/CrashDebugger.cpp:549
@@ +548,3 @@
+  // delete them all at once to avoid invalidating the iterator
+  std::vector<NamedMDNode *> ToDelete;
+  for (auto &NamedMD : M->named_metadata())
----------------
Possibly: ToDelete.reserve(NamedMD.size())?

================
Comment at: tools/bugpoint/CrashDebugger.cpp:611
@@ +610,3 @@
+  ValueToValueMapTy VMap;
+  Module *M = CloneModule(BD.getProgram(), VMap);
+
----------------
shared_ptr

================
Comment at: tools/bugpoint/CrashDebugger.cpp:615
@@ +614,3 @@
+  // these dropped during cloning.
+  for (auto &NamedMD : BD.getProgram()->named_metadata()) {
+    // Drop the old one and create a new one
----------------
Do you need to worry about iterator invalidation here?

Would it be easier to just remove the operands or set them to undef?

================
Comment at: tools/bugpoint/CrashDebugger.cpp:816
@@ +815,3 @@
+
+  if (!BugpointIsInterrupted) {
+    // Try to reduce the amount of global metadata (particularly debug info),
----------------
Please add an option to easily disable these passes.

================
Comment at: tools/bugpoint/CrashDebugger.cpp:821
@@ +820,3 @@
+    std::vector<std::string> NamedMDNames;
+    for (auto &NamedMD : BD.getProgram()->named_metadata())
+      NamedMDNames.push_back(NamedMD.getName().str());
----------------
insert(end, md_begin, md_end)

================
Comment at: tools/bugpoint/CrashDebugger.cpp:831
@@ +830,3 @@
+    for (auto &NamedMD : BD.getProgram()->named_metadata())
+      for (auto op : NamedMD.operands())
+        NamedMDOps.push_back(op);
----------------
insert(end, op_begin, op_end)


Repository:
  rL LLVM

http://reviews.llvm.org/D14043





More information about the llvm-commits mailing list