From f25c19c6b57aec5670e87dc57840c6ac12252099 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 9 Jun 2006 18:33:30 +0000 Subject: Make Loop able to verify that it is in LCSSA-form, and have the LCSSA pass assert on this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28738 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LoopInfo.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/Analysis/LoopInfo.cpp') diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index c7ce58ef91..eed2cd6c4e 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -479,6 +479,22 @@ Value *Loop::getTripCount() const { return 0; } +/// isLCSSAForm - Return true if the Loop is in LCSSA form +bool Loop::isLCSSAForm() const { + for (Loop::block_iterator BB = block_begin(), E = block_end(); + BB != E; ++BB) { + for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ++I) + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; + ++UI) { + BasicBlock *UserBB = cast(*UI)->getParent(); + if (!isa(*UI) && !contains(UserBB)) { + return false; + } + } + } + + return true; +} //===-------------------------------------------------------------------===// // APIs for updating loop information after changing the CFG -- cgit v1.2.3