[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


================
@@ -2216,25 +2244,8 @@ findPrologueEndLoc(const MachineFunction *MF) {
       continue;
     }
 
-    // We've reached the end of the block. Did we just look at a terminator?
-    if (CurInst->isTerminator()) {
-      // Some kind of "real" control flow is occurring. At the very least
-      // we would have to start exploring the CFG, a good signal that the
-      // prologue is over.
-      break;
-    }
-
-    // If we've already fallen through into a loop, don't fall through
-    // further, use a backup-location.
-    if (CurBlock->pred_size() > 1)
-      break;
-
-    // Fall-through from entry to the next block. This is common at -O0 when
-    // there's no initialisation in the function. Bail if we're also at the
-    // end of the function.
-    if (++CurBlock == MF->end())
+    if (!getNextInst())
----------------
OCHyams wrote:

I get what this is doing but from the name `getNextInst()` I think it sounds more like it's doing `auto NextInst = std::next(CurInst)` as above. Maybe `getNextBlockInst` ? That doesn't sound great either. `findNextBlock`? Ymmv, feel free to ignore.

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


More information about the llvm-commits mailing list