Skip to content

Commit 3dfabc2

Browse files
committed
Restructure a function
1 parent ef0971e commit 3dfabc2

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

llvm/lib/IR/BasicBlock.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -372,22 +372,19 @@ const Instruction* BasicBlock::getFirstNonPHI() const {
372372
}
373373

374374
BasicBlock::const_iterator BasicBlock::getFirstNonPHIIt() const {
375-
const Instruction *I = [&]() -> const Instruction * {
376-
for (const Instruction &I : *this)
377-
if (!isa<PHINode>(I))
378-
return &I;
379-
return nullptr;
380-
}();
375+
for (const Instruction &I : *this) {
376+
if (isa<PHINode>(I))
377+
continue;
381378

382-
if (!I)
383-
return end();
379+
BasicBlock::const_iterator It = I.getIterator();
380+
// Set the head-inclusive bit to indicate that this iterator includes
381+
// any debug-info at the start of the block. This is a no-op unless the
382+
// appropriate CMake flag is set.
383+
It.setHeadBit(true);
384+
return It;
385+
}
384386

385-
BasicBlock::const_iterator It = I->getIterator();
386-
// Set the head-inclusive bit to indicate that this iterator includes
387-
// any debug-info at the start of the block. This is a no-op unless the
388-
// appropriate CMake flag is set.
389-
It.setHeadBit(true);
390-
return It;
387+
return end();
391388
}
392389

393390
const Instruction *BasicBlock::getFirstNonPHIOrDbg(bool SkipPseudoOp) const {

0 commit comments

Comments
 (0)