[llvm] [llvm/llvm-project][Coroutines] Improve debugging and minor refactoring (PR #104642)
Yuxuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 13:18:35 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);
----------------
yuxuanchen1997 wrote:
Under the hood, `printAsOperand` uses `SlotTracker`. (https://github.com/llvm/llvm-project/blob/main/llvm/lib/IR/AsmWriter.cpp#L2599-L2629)
However, it's not entirely clear to me that this slot number will be stable across passes. Looking at the code, it's `printAsOperand` creates the `SlotTracker`. For immediate dumping of the code this may work fine but if you do this again in another pass you may get a different number for the same BB because values can be inserted above.
https://github.com/llvm/llvm-project/pull/104642
More information about the llvm-commits
mailing list