diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-03 15:34:35 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-03 15:34:35 +0000 |
commit | 22571485b33b3535f8c224d477a4bb4252b2152c (patch) | |
tree | 114bc091ffe3462a4429754dda83d25683515e8d /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 96a26bd35a4e9e8defd73e3f93daeb7927aa7d5d (diff) | |
download | bcm5719-llvm-22571485b33b3535f8c224d477a4bb4252b2152c.tar.gz bcm5719-llvm-22571485b33b3535f8c224d477a4bb4252b2152c.zip |
Change PHINode::hasConstantValue to have a DominatorTree argument
instead of a bool argument, and to do the dominator check itself.
This makes it eaiser to use when DominatorTree information is
available.
llvm-svn: 80920
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index c3d6194801d..c165e04fb8a 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -429,13 +429,10 @@ BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB, PN->addIncoming(InVal, NewBB); // Check to see if we can eliminate this phi node. - if (Value *V = PN->hasConstantValue(DT != 0)) { - Instruction *I = dyn_cast<Instruction>(V); - if (!I || DT == 0 || DT->dominates(I, PN)) { - PN->replaceAllUsesWith(V); - if (AA) AA->deleteValue(PN); - PN->eraseFromParent(); - } + if (Value *V = PN->hasConstantValue(DT)) { + PN->replaceAllUsesWith(V); + if (AA) AA->deleteValue(PN); + PN->eraseFromParent(); } } |