[llvm] [BOLT][NFC] Simplify CFG validation (PR #91977)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 10:17:06 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Nathan Sidwell (urnathan)
<details>
<summary>Changes</summary>
I noticed this `Valid` local had one use, whereas the rest of the function just directly returned false on failure
---
Full diff: https://github.com/llvm/llvm-project/pull/91977.diff
1 Files Affected:
- (modified) bolt/lib/Core/BinaryFunction.cpp (+3-6)
``````````diff
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index de34421ebeb08..4f44ba0d970c0 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -3252,12 +3252,9 @@ bool BinaryFunction::validateCFG() const {
if (CurrentState == State::CFG_Finalized)
return true;
- bool Valid = true;
for (BinaryBasicBlock *BB : BasicBlocks)
- Valid &= BB->validateSuccessorInvariants();
-
- if (!Valid)
- return Valid;
+ if (!BB->validateSuccessorInvariants())
+ return false;
// Make sure all blocks in CFG are valid.
auto validateBlock = [this](const BinaryBasicBlock *BB, StringRef Desc) {
@@ -3326,7 +3323,7 @@ bool BinaryFunction::validateCFG() const {
}
}
- return Valid;
+ return true;
}
void BinaryFunction::fixBranches() {
``````````
</details>
https://github.com/llvm/llvm-project/pull/91977
More information about the llvm-commits
mailing list