Index: include/llvm/IR/DomTreeUpdater.h =================================================================== --- include/llvm/IR/DomTreeUpdater.h +++ include/llvm/IR/DomTreeUpdater.h @@ -46,8 +46,11 @@ ~DomTreeUpdater() { flush(); } - /// Returns the UpdateStrategy of the class instance. - UpdateStrategy getUpdateStrategy() const { return Strategy; }; + /// Returns true if the current strategy is Lazy. + bool isLazy() const { return Strategy == UpdateStrategy::Lazy; }; + + /// Returns true if the current strategy is Eager. + bool isEager() const { return Strategy == UpdateStrategy::Eager; }; /// Returns true if it holds a DominatorTree. bool hasDomTree() const { return DT != nullptr; } Index: unittests/IR/DomTreeUpdaterTest.cpp =================================================================== --- unittests/IR/DomTreeUpdaterTest.cpp +++ unittests/IR/DomTreeUpdaterTest.cpp @@ -58,7 +58,8 @@ ASSERT_TRUE(DTU.hasDomTree()); ASSERT_TRUE(DTU.hasPostDomTree()); - ASSERT_EQ(DTU.getUpdateStrategy(), DomTreeUpdater::UpdateStrategy::Eager); + ASSERT_TRUE(DTU.isEager()); + ASSERT_FALSE(DTU.isLazy()); ASSERT_TRUE(DTU.getDomTree().verify()); ASSERT_TRUE(DTU.getPostDomTree().verify()); ASSERT_FALSE(DTU.hasPendingUpdates()); @@ -166,7 +167,8 @@ DomTreeUpdater DTU(DT, PDT, DomTreeUpdater::UpdateStrategy::Eager); ASSERT_TRUE(DTU.hasDomTree()); ASSERT_TRUE(DTU.hasPostDomTree()); - ASSERT_EQ(DTU.getUpdateStrategy(), DomTreeUpdater::UpdateStrategy::Eager); + ASSERT_TRUE(DTU.isEager()); + ASSERT_FALSE(DTU.isLazy()); ASSERT_TRUE(DT.verify()); ASSERT_TRUE(PDT.verify()); @@ -239,7 +241,8 @@ DomTreeUpdater DTU(&DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy); ASSERT_TRUE(DTU.hasDomTree()); ASSERT_FALSE(DTU.hasPostDomTree()); - ASSERT_EQ(DTU.getUpdateStrategy(), DomTreeUpdater::UpdateStrategy::Lazy); + ASSERT_FALSE(DTU.isEager()); + ASSERT_TRUE(DTU.isLazy()); ASSERT_TRUE(DTU.getDomTree().verify()); Function::iterator FI = F->begin(); @@ -327,7 +330,8 @@ DomTreeUpdater DTU(&DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy); ASSERT_TRUE(DTU.hasDomTree()); ASSERT_FALSE(DTU.hasPostDomTree()); - ASSERT_EQ(DTU.getUpdateStrategy(), DomTreeUpdater::UpdateStrategy::Lazy); + ASSERT_FALSE(DTU.isEager()); + ASSERT_TRUE(DTU.isLazy()); ASSERT_TRUE(DTU.getDomTree().verify()); Function::iterator FI = F->begin(); @@ -453,7 +457,8 @@ DomTreeUpdater DTU(&DT, &PDT, DomTreeUpdater::UpdateStrategy::Lazy); ASSERT_TRUE(DTU.hasDomTree()); ASSERT_TRUE(DTU.hasPostDomTree()); - ASSERT_EQ(DTU.getUpdateStrategy(), DomTreeUpdater::UpdateStrategy::Lazy); + ASSERT_FALSE(DTU.isEager()); + ASSERT_TRUE(DTU.isLazy()); ASSERT_TRUE(DTU.getDomTree().verify()); ASSERT_TRUE(DTU.getPostDomTree().verify()); @@ -535,7 +540,8 @@ DomTreeUpdater DTU(DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy); ASSERT_TRUE(DTU.hasDomTree()); ASSERT_TRUE(DTU.hasPostDomTree()); - ASSERT_EQ(DTU.getUpdateStrategy(), DomTreeUpdater::UpdateStrategy::Lazy); + ASSERT_FALSE(DTU.isEager()); + ASSERT_TRUE(DTU.isLazy()); ASSERT_TRUE(DTU.getDomTree().verify()); ASSERT_TRUE(DTU.getPostDomTree().verify()); @@ -624,7 +630,8 @@ ASSERT_TRUE(DTU.hasDomTree()); ASSERT_TRUE(DTU.hasPostDomTree()); - ASSERT_EQ(DTU.getUpdateStrategy(), DomTreeUpdater::UpdateStrategy::Lazy); + ASSERT_FALSE(DTU.isEager()); + ASSERT_TRUE(DTU.isLazy()); ASSERT_TRUE(DTU.getDomTree().verify()); ASSERT_TRUE(DTU.getPostDomTree().verify()); ASSERT_FALSE(DTU.hasPendingUpdates());