summaryrefslogtreecommitdiff
path: root/lib/VMCore/Dominators.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-04-14 23:57:00 +0000
committerOwen Anderson <resistor@mac.com>2007-04-14 23:57:00 +0000
commit9a341ff3c1cf54af7bda18726a0a30f3de4fa353 (patch)
treeb88e72d12499b3921e35b90ca59b1149e9c1be18 /lib/VMCore/Dominators.cpp
parent690c684fc60883171c01da12d826fda6b5678aa8 (diff)
downloadllvm-9a341ff3c1cf54af7bda18726a0a30f3de4fa353.tar.gz
llvm-9a341ff3c1cf54af7bda18726a0a30f3de4fa353.tar.bz2
llvm-9a341ff3c1cf54af7bda18726a0a30f3de4fa353.tar.xz
Fix some unsafe code. Also, tabs -> spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Dominators.cpp')
-rw-r--r--lib/VMCore/Dominators.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index da8d36d902..0959b07b47 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -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) {