diff options
author | Owen Anderson <resistor@mac.com> | 2006-06-09 18:33:30 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2006-06-09 18:33:30 +0000 |
commit | f25c19c6b57aec5670e87dc57840c6ac12252099 (patch) | |
tree | 696a944997fa35f334b7ebde573e2c48216951a8 /lib | |
parent | e5e228df19d6e9e1218fecfb49f8ef1f53d6759c (diff) | |
download | external_llvm-f25c19c6b57aec5670e87dc57840c6ac12252099.zip external_llvm-f25c19c6b57aec5670e87dc57840c6ac12252099.tar.gz external_llvm-f25c19c6b57aec5670e87dc57840c6ac12252099.tar.bz2 |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/LoopInfo.cpp | 16 | ||||
-rw-r--r-- | lib/Transforms/Utils/LCSSA.cpp | 4 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index c7ce58e..eed2cd6 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<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/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index e1af50e..ecbf180 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -98,7 +98,7 @@ bool LCSSA::runOnFunction(Function &F) { for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) { changed |= visitSubloop(*I); } - + return changed; } @@ -132,6 +132,8 @@ bool LCSSA::visitSubloop(Loop* L) { processInstruction(*I, exitBlocks); } + assert(L->isLCSSAForm()); + return true; } |