From a4c8952e6d4c67cca8387e6951e41c1bd4d5960e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 1 May 2021 12:39:01 -0700 Subject: [PATCH] Microoptimize dominance a bit - NFC. Don't get RegionKindInterface if we won't use it. Noticed by inspection. --- mlir/lib/IR/Dominance.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp index 6bc2d5a..16c98d6 100644 --- a/mlir/lib/IR/Dominance.cpp +++ b/mlir/lib/IR/Dominance.cpp @@ -27,9 +27,10 @@ template class llvm::DomTreeNodeBase; /// 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(op); - return op->isRegistered() && - (!kindInterface || kindInterface.hasSSADominance(index)); + return !kindInterface || kindInterface.hasSSADominance(index); } //===----------------------------------------------------------------------===// -- 2.7.4