From 22571485b33b3535f8c224d477a4bb4252b2152c Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 3 Sep 2009 15:34:35 +0000 Subject: 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 --- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp') diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 6a56a8d8245..8274e5aeb61 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -494,17 +494,14 @@ void PromoteMem2Reg::run() { PHINode *PN = I->second; // If this PHI node merges one value and/or undefs, get the value. - if (Value *V = PN->hasConstantValue(true)) { - if (!isa(V) || - properlyDominates(cast(V), PN)) { - if (AST && isa(PN->getType())) - AST->deleteValue(PN); - PN->replaceAllUsesWith(V); - PN->eraseFromParent(); - NewPhiNodes.erase(I++); - EliminatedAPHI = true; - continue; - } + if (Value *V = PN->hasConstantValue(&DT)) { + if (AST && isa(PN->getType())) + AST->deleteValue(PN); + PN->replaceAllUsesWith(V); + PN->eraseFromParent(); + NewPhiNodes.erase(I++); + EliminatedAPHI = true; + continue; } ++I; } -- cgit v1.2.3