[Mlir-commits] [mlir] 066b320 - Use early exist and simplify a condition in Block SuccessorRange (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Wed Jun 16 12:43:24 PDT 2021
Author: Mehdi Amini
Date: 2021-06-16T19:42:41Z
New Revision: 066b3207234d098b6bf25d7c55e47c5a7b8dcfc7
URL: https://github.com/llvm/llvm-project/commit/066b3207234d098b6bf25d7c55e47c5a7b8dcfc7
DIFF: https://github.com/llvm/llvm-project/commit/066b3207234d098b6bf25d7c55e47c5a7b8dcfc7.diff
LOG: Use early exist and simplify a condition in Block SuccessorRange (NFC)
Added:
Modified:
mlir/lib/IR/Block.cpp
Removed:
################################################################################
diff --git a/mlir/lib/IR/Block.cpp b/mlir/lib/IR/Block.cpp
index 364173d3c1be..15c1d2096eed 100644
--- a/mlir/lib/IR/Block.cpp
+++ b/mlir/lib/IR/Block.cpp
@@ -346,11 +346,11 @@ unsigned PredecessorIterator::getSuccessorIndex() const {
SuccessorRange::SuccessorRange() : SuccessorRange(nullptr, 0) {}
SuccessorRange::SuccessorRange(Block *block) : SuccessorRange() {
- if (!block->empty() && !llvm::hasSingleElement(*block->getParent())) {
- Operation *term = &block->back();
- if ((count = term->getNumSuccessors()))
- base = term->getBlockOperands().data();
- }
+ if (block->empty() || llvm::hasSingleElement(*block->getParent()))
+ return;
+ Operation *term = &block->back();
+ if ((count = term->getNumSuccessors()))
+ base = term->getBlockOperands().data();
}
SuccessorRange::SuccessorRange(Operation *term) : SuccessorRange() {
More information about the Mlir-commits
mailing list