1
0
mirror of https://github.com/c64scene-ar/llvm-6502.git synced 2025-04-14 06:37:33 +00:00

Fix some unsafe code. Also, tabs -> spaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36035 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-04-14 23:57:00 +00:00
parent 690c684fc6
commit 9a341ff3c1

@ -929,13 +929,13 @@ ETNode *ETForest::getNodeForBlock(BasicBlock *BB) {
// Haven't calculated this node yet? Get or calculate the node for the
// immediate dominator.
BasicBlock *IDom = getAnalysis<DominatorTree>().getNode(BB)->getIDom()->getBlock();
DominatorTree::Node *node= getAnalysis<DominatorTree>().getNode(BB);
// If we are unreachable, we may not have an immediate dominator.
if (!IDom)
if (!node || !node->getIDom())
return BBNode = new ETNode(BB);
else {
ETNode *IDomNode = getNodeForBlock(IDom);
ETNode *IDomNode = getNodeForBlock(node->getIDom()->getBlock());
// Add a new tree node for this BasicBlock, and link it as a child of
// IDomNode
@ -953,9 +953,9 @@ void ETForest::calculate(const DominatorTree &DT) {
Function *F = Root->getParent();
// Loop over all of the reachable blocks in the function...
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
DominatorTree::Node* node = DT.getNode(I);
DominatorTree::Node* node = DT.getNode(I);
if (node && node->getIDom()) { // Reachable block.
BasicBlock* ImmDom = node->getIDom()->getBlock();
BasicBlock* ImmDom = node->getIDom()->getBlock();
ETNode *&BBNode = Nodes[I];
if (!BBNode) { // Haven't calculated this node yet?
// Get or calculate the node for the immediate dominator
@ -967,7 +967,7 @@ void ETForest::calculate(const DominatorTree &DT) {
BBNode->setFather(IDomNode);
}
}
}
}
// Make sure we've got nodes around for every block
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {