Microoptimize dominance a bit - NFC.
authorChris Lattner <clattner@nondot.org>
Sat, 1 May 2021 19:39:01 +0000 (12:39 -0700)
committerChris Lattner <clattner@nondot.org>
Sat, 1 May 2021 19:40:13 +0000 (12:40 -0700)
Don't get RegionKindInterface if we won't use it. Noticed by inspection.

mlir/lib/IR/Dominance.cpp

index 6bc2d5a..16c98d6 100644 (file)
@@ -27,9 +27,10 @@ template class llvm::DomTreeNodeBase<Block>;
 /// Return true if the region with the given index inside the operation
 /// has SSA dominance.
 static bool hasSSADominance(Operation *op, unsigned index) {
+  if (!op->isRegistered()) return false;
+
   auto kindInterface = dyn_cast<RegionKindInterface>(op);
-  return op->isRegistered() &&
-         (!kindInterface || kindInterface.hasSSADominance(index));
+  return !kindInterface || kindInterface.hasSSADominance(index);
 }
 
 //===----------------------------------------------------------------------===//