[PATCH] [LayoutPass] Add a method to check the followon graph structure.

Shankar Kalpathi Easwaran shankarke at gmail.com
Thu Jun 6 07:25:25 PDT 2013


  Just a thought, Can the code be converted to a pass that can be enabled in debug/release mode only to check for cycles, Just like the LayoutPass ?


================
Comment at: lib/Passes/LayoutPass.cpp:409-413
@@ +408,7 @@
+  llvm::raw_string_ostream s(str);
+  if (definedAtom->name().empty()) {
+    s << "<anonymous " << definedAtom << ">";
+  } else {
+    s << definedAtom->name();
+  }
+  s << " in ";
----------------
no need of empty braces.

================
Comment at: lib/Passes/LayoutPass.cpp:415-419
@@ +414,7 @@
+  s << " in ";
+  if (definedAtom->customSectionName().empty()) {
+    s << "<anonymous>";
+  } else {
+    s << definedAtom->customSectionName();
+  }
+  s.flush();
----------------
same here.

================
Comment at: lib/Passes/LayoutPass.cpp:405-408
@@ +404,6 @@
+
+std::string atomToDebugString(const Atom *atom) {
+  const DefinedAtom *definedAtom = llvm::dyn_cast<DefinedAtom>(atom);
+  std::string str;
+  llvm::raw_string_ostream s(str);
+  if (definedAtom->name().empty()) {
----------------
should these be changed to StringRef ?

================
Comment at: lib/Passes/LayoutPass.cpp:461
@@ +460,3 @@
+  if (i == followOnRoots.end()) {
+    std::string msg = "Atom <" + atomToDebugString(atom)
+        + "> has no follow-on root!";
----------------
Same here, you could StringRef and twine.

================
Comment at: lib/Passes/LayoutPass.cpp:469
@@ +468,3 @@
+    if (!next) {
+      std::string msg = "Atom <" + atomToDebugString(atom)
+          + "> is not reachable from its root!";
----------------
Same here.


http://llvm-reviews.chandlerc.com/D922



More information about the llvm-commits mailing list