Skip to content

Commit 725014d

Browse files
authored
[BOLT][NFC] Simplify CFG validation (#91977)
Remove 'Valid' local boolean that has a single use, and return directly instead.
1 parent cfa0947 commit 725014d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,12 +3252,9 @@ bool BinaryFunction::validateCFG() const {
32523252
if (CurrentState == State::CFG_Finalized)
32533253
return true;
32543254

3255-
bool Valid = true;
32563255
for (BinaryBasicBlock *BB : BasicBlocks)
3257-
Valid &= BB->validateSuccessorInvariants();
3258-
3259-
if (!Valid)
3260-
return Valid;
3256+
if (!BB->validateSuccessorInvariants())
3257+
return false;
32613258

32623259
// Make sure all blocks in CFG are valid.
32633260
auto validateBlock = [this](const BinaryBasicBlock *BB, StringRef Desc) {
@@ -3326,7 +3323,7 @@ bool BinaryFunction::validateCFG() const {
33263323
}
33273324
}
33283325

3329-
return Valid;
3326+
return true;
33303327
}
33313328

33323329
void BinaryFunction::fixBranches() {

0 commit comments

Comments
 (0)