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 | 798e541fbdd6cdc2da6e6f153b3704d350bd3167 (patch) | |
tree | bf1ea31f55e271210a43862a4fe5c64749b8c796 /lib/Transforms/Utils/PromoteMemoryToRegister.cpp | |
parent | 242b4738d28335a58e08db01c2748d0488885348 (diff) | |
download | external_llvm-798e541fbdd6cdc2da6e6f153b3704d350bd3167.zip external_llvm-798e541fbdd6cdc2da6e6f153b3704d350bd3167.tar.gz external_llvm-798e541fbdd6cdc2da6e6f153b3704d350bd3167.tar.bz2 |
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/PromoteMemoryToRegister.cpp')
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 6a56a8d..8274e5a 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/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<Instruction>(V) || - properlyDominates(cast<Instruction>(V), PN)) { - if (AST && isa<PointerType>(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<PointerType>(PN->getType())) + AST->deleteValue(PN); + PN->replaceAllUsesWith(V); + PN->eraseFromParent(); + NewPhiNodes.erase(I++); + EliminatedAPHI = true; + continue; } ++I; } |