mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
Fix bug: test/Regression/Assembler/2002-08-22-DominanceProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e6d2fdff26
commit
80b7f8ceb4
@ -36,21 +36,15 @@ bool DominatorSetBase::dominates(Instruction *A, Instruction *B) const {
|
|||||||
return &*I == A;
|
return &*I == A;
|
||||||
}
|
}
|
||||||
|
|
||||||
// runOnFunction - This method calculates the forward dominator sets for the
|
|
||||||
// specified function.
|
|
||||||
//
|
|
||||||
bool DominatorSet::runOnFunction(Function &F) {
|
|
||||||
Doms.clear(); // Reset from the last time we were run...
|
|
||||||
Root = &F.getEntryNode();
|
|
||||||
assert(pred_begin(Root) == pred_end(Root) &&
|
|
||||||
"Root node has predecessors in function!");
|
|
||||||
|
|
||||||
|
void DominatorSet::calculateDominatorsFromBlock(BasicBlock *RootBB) {
|
||||||
bool Changed;
|
bool Changed;
|
||||||
|
Doms[RootBB].insert(RootBB); // Root always dominates itself...
|
||||||
do {
|
do {
|
||||||
Changed = false;
|
Changed = false;
|
||||||
|
|
||||||
DomSetType WorkingSet;
|
DomSetType WorkingSet;
|
||||||
df_iterator<Function*> It = df_begin(&F), End = df_end(&F);
|
df_iterator<BasicBlock*> It = df_begin(RootBB), End = df_end(RootBB);
|
||||||
for ( ; It != End; ++It) {
|
for ( ; It != End; ++It) {
|
||||||
BasicBlock *BB = *It;
|
BasicBlock *BB = *It;
|
||||||
pred_iterator PI = pred_begin(BB), PEnd = pred_end(BB);
|
pred_iterator PI = pred_begin(BB), PEnd = pred_end(BB);
|
||||||
@ -78,16 +72,32 @@ bool DominatorSet::runOnFunction(Function &F) {
|
|||||||
WorkingSet.clear(); // Clear out the set for next iteration
|
WorkingSet.clear(); // Clear out the set for next iteration
|
||||||
}
|
}
|
||||||
} while (Changed);
|
} while (Changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// runOnFunction - This method calculates the forward dominator sets for the
|
||||||
|
// specified function.
|
||||||
|
//
|
||||||
|
bool DominatorSet::runOnFunction(Function &F) {
|
||||||
|
Doms.clear(); // Reset from the last time we were run...
|
||||||
|
Root = &F.getEntryNode();
|
||||||
|
assert(pred_begin(Root) == pred_end(Root) &&
|
||||||
|
"Root node has predecessors in function!");
|
||||||
|
|
||||||
|
// Calculate dominator sets for the reachable basic blocks...
|
||||||
|
calculateDominatorsFromBlock(Root);
|
||||||
|
|
||||||
// Every basic block in the function should at least dominate themselves, and
|
// Every basic block in the function should at least dominate themselves, and
|
||||||
// thus every basic block should have an entry in Doms. The one case where we
|
// thus every basic block should have an entry in Doms. The one case where we
|
||||||
// miss this is when a basic block is unreachable. To get these we now do an
|
// miss this is when a basic block is unreachable. To get these we now do an
|
||||||
// extra pass adding self dominance info to the DomSet if the block doesn't
|
// extra pass over the function, calculating dominator information for
|
||||||
// already have an entry.
|
// unreachable blocks.
|
||||||
//
|
//
|
||||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
|
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
|
||||||
if (Doms[I].empty())
|
if (Doms[I].empty()) {
|
||||||
Doms[I].insert(I);
|
calculateDominatorsFromBlock(I);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user