Skip to content

Commit d1899c0

Browse files
committed
Review feedback
1 parent 6cce004 commit d1899c0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,13 +2193,14 @@ findPrologueEndLoc(const MachineFunction *MF) {
21932193
auto CurBlock = MF->begin();
21942194
auto CurInst = CurBlock->begin();
21952195

2196-
// Find the initial instruction, we're guaranteed one by the caller.
2196+
// Find the initial instruction, we're guaranteed one by the caller, but not
2197+
// which block it's in.
21972198
while (CurBlock->empty())
21982199
CurInst = (++CurBlock)->begin();
2200+
assert(CurInst != CurBlock->end());
21992201

22002202
// Helper function for stepping through the initial sequence of
2201-
// unconditionally executed instructions. The optimiser will also chuck in
2202-
// sequences of empty blocks alas.
2203+
// unconditionally executed instructions.
22032204
auto getNextInst = [&CurBlock, &CurInst, MF]() -> bool {
22042205
// We've reached the end of the block. Did we just look at a terminator?
22052206
if (CurInst->isTerminator()) {
@@ -2217,7 +2218,9 @@ findPrologueEndLoc(const MachineFunction *MF) {
22172218
// Fall-through from entry to the next block. This is common at -O0 when
22182219
// there's no initialisation in the function. Bail if we're also at the
22192220
// end of the function, or the remaining blocks have no instructions.
2220-
// Skip empty blocks, in rare cases the entry can be empty.
2221+
// Skip empty blocks, in rare cases the entry can be empty, and
2222+
// other optimisations may add empty blocks that the control flow falls
2223+
// through.
22212224
do {
22222225
++CurBlock;
22232226
if (CurBlock == MF->end())

0 commit comments

Comments
 (0)