mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-27 17:31:33 +00:00
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
This commit is contained in:
parent
e5e228df19
commit
f25c19c6b5
@ -147,6 +147,9 @@ public:
|
|||||||
///
|
///
|
||||||
Value *getTripCount() const;
|
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
|
// APIs for updating loop information after changing the CFG
|
||||||
//
|
//
|
||||||
|
@ -479,6 +479,22 @@ Value *Loop::getTripCount() const {
|
|||||||
return 0;
|
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
|
// APIs for updating loop information after changing the CFG
|
||||||
|
@ -132,6 +132,8 @@ bool LCSSA::visitSubloop(Loop* L) {
|
|||||||
processInstruction(*I, exitBlocks);
|
processInstruction(*I, exitBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(L->isLCSSAForm());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user