[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 27 01:25:41 PST 2025


================
@@ -150,29 +152,38 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   EmulateInstruction::InstructionCondition last_condition =
       EmulateInstruction::UnconditionalCondition;
 
-  for (const InstructionSP &inst : inst_list.Instructions()) {
-    if (!inst)
-      continue;
-    DumpInstToLog(log, *inst, inst_list);
+  std::deque<std::size_t> to_visit = {0};
+  llvm::SmallSet<std::size_t, 0> enqueued = {0};
+
+  // Instructions reachable through jumps are inserted on the front.
+  // The next instruction in inserted on the back.
+  // Pop from the back to ensure non-branching instructions are visited
+  // sequentially.
+  while (!to_visit.empty()) {
+    std::size_t current_index = to_visit.back();
----------------
felipepiovezan wrote:

`pop_back` does not return the value popped. You might be thinking of `pop_back_val`, which is an LLVM ADT function available in things like SmallVector

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


More information about the lldb-commits mailing list