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 | bccfc24c4e8092e1ee18746dd4cee01247728faa (patch) | |
tree | bf1ea31f55e271210a43862a4fe5c64749b8c796 /lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | dd12de686cb0a3bcff879ae895fe461caa6f7842 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | lib/Transforms/Utils/BasicBlockUtils.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index c3d6194801..c165e04fb8 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/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(); } } |