From: Owen Anderson Date: Sun, 11 Jun 2006 19:22:28 +0000 (+0000) Subject: Re-commit the safe parts of my 6/9 patch. Still working on fixing the unsafe parts. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=c2cc15cf9d926b8de41dabba86005a55806127a0;p=oota-llvm.git Re-commit the safe parts of my 6/9 patch. Still working on fixing the unsafe parts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28748 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 06b007cf3fc..17363df3957 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -146,6 +146,9 @@ public: /// this returns null. /// Value *getTripCount() const; + + /// isLCSSAForm - Return true if the Loop is in LCSSA form + bool isLCSSAForm() const; //===--------------------------------------------------------------------===// // APIs for updating loop information after changing the CFG diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index c7ce58ef915..eed2cd6c4ef 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 diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index e1af50e7454..ed02c977430 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -132,6 +132,8 @@ bool LCSSA::visitSubloop(Loop* L) { processInstruction(*I, exitBlocks); } + assert(L->isLCSSAForm()); + return true; }