[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();
+
+  // Helper function for stepping through the initial sequence of
+  // unconditionally executed instructions. The optimiser will also chuck in
+  // sequences of empty blocks alas.
----------------
OCHyams wrote:

I wonder if "The optimiser will also chuck in sequences of empty blocks alas." is slightly too informal (could cause trouble for folks with English as a 2nd language?). Also probably worth moving this part of the into the lambda body as it seems more like an implementation detail?

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


More information about the llvm-commits mailing list