diff options
| author | Owen Anderson <resistor@mac.com> | 2006-06-11 19:22:28 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2006-06-11 19:22:28 +0000 |
| commit | b538f14d2a4afeb9628b2791d387e2ce117ceec6 (patch) | |
| tree | f58179802da9f414a973c9e3f21be4d38a3ff996 | |
| parent | 1b6e310e6f1e8bedf30ddef5a8903bdd0c648479 (diff) | |
| download | bcm5719-llvm-b538f14d2a4afeb9628b2791d387e2ce117ceec6.tar.gz bcm5719-llvm-b538f14d2a4afeb9628b2791d387e2ce117ceec6.zip | |
Re-commit the safe parts of my 6/9 patch. Still working on fixing the unsafe parts.
llvm-svn: 28748
| -rw-r--r-- | llvm/include/llvm/Analysis/LoopInfo.h | 3 | ||||
| -rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 16 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/LCSSA.cpp | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h index 06b007cf3fc..17363df3957 100644 --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/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/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index c7ce58ef915..eed2cd6c4ef 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/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<Instruction>(*UI)->getParent(); + if (!isa<PHINode>(*UI) && !contains(UserBB)) { + return false; + } + } + } + + return true; +} //===-------------------------------------------------------------------===// // APIs for updating loop information after changing the CFG diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp index e1af50e7454..ed02c977430 100644 --- a/llvm/lib/Transforms/Utils/LCSSA.cpp +++ b/llvm/lib/Transforms/Utils/LCSSA.cpp @@ -132,6 +132,8 @@ bool LCSSA::visitSubloop(Loop* L) { processInstruction(*I, exitBlocks); } + assert(L->isLCSSAForm()); + return true; } |

