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

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 05:44:19 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();
+
----------------
OCHyams wrote:

`// Find the initial instruction, we're guaranteed one by the caller.` Can we assert `CurInst != CurBlock->end()` here to check that?

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


More information about the llvm-commits mailing list