[llvm] [llvm/llvm-project][Coroutines] Improve debugging and minor refactoring (PR #104642)

Tyler Nowicki via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 07:57:00 PDT 2024


================
@@ -52,6 +53,16 @@ extern cl::opt<bool> UseNewDbgInfoFormat;
 
 enum { SmallVectorThreshold = 32 };
 
+static std::string getBasicBlockLabel(const BasicBlock *BB) {
+  if (BB->hasName())
+    return BB->getName().str();
+
+  std::string S;
+  raw_string_ostream OS(S);
+  BB->printAsOperand(OS, false);
+  return OS.str().substr(1);
----------------
TylerNowicki wrote:

I agree, I will remove it. But I want to point out that BB->getName returns an empty string if the BB has no name, same goes for Instructions. For example, BBs with names like 1234: and Instructions with names like %456 do not have a name. So when we create basic blocks with 'BB->getName() + Twine(".from.") + Pred)->getName()' in most cases that produces a BB called ".from."

https://github.com/llvm/llvm-project/pull/104642


More information about the llvm-commits mailing list