[llvm] [DebugInfo] Handle trailing empty blocks when seeking prologue_end spot (PR #117320)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 09:31:20 PST 2024


================
@@ -2192,14 +2192,42 @@ findPrologueEndLoc(const MachineFunction *MF) {
   // better off synthesising an early prologue_end.
   auto CurBlock = MF->begin();
   auto CurInst = CurBlock->begin();
-  while (true) {
+
+  // Find the initial instruction, we're guaranteed one by the caller.
+  while (CurBlock->empty())
+    CurInst = (++CurBlock)->begin();
+
+  // Helper function for stepping through the initial sequence of
+  // unconditionally executed instructions. The optimiser will also chuck in
+  // sequences of empty blocks alas.
----------------
jmorse wrote:

Ah yeah, this is written in my default "Jeremy-flippancy" dialect 

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


More information about the llvm-commits mailing list