diff options
author | Duncan Sands <baldrick@free.fr> | 2010-11-16 17:41:24 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-11-16 17:41:24 +0000 |
commit | cdbd99262286e96729007ac535cd430ecb3d38ac (patch) | |
tree | 29ee4b438d3edd840c88bd268c3bfe4815f0b29a /lib/Transforms/Utils/PromoteMemoryToRegister.cpp | |
parent | ab7fa0885e8351c0d510938caeac83d3000031d1 (diff) |
Have a few places that want to simplify phi nodes use SimplifyInstruction
rather than calling hasConstantValue. No intended functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119352 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/PromoteMemoryToRegister.cpp')
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index a4e3029e3a..092cfbbcab 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -24,9 +24,10 @@ #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/Metadata.h" +#include "llvm/Analysis/AliasSetTracker.h" #include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/Dominators.h" -#include "llvm/Analysis/AliasSetTracker.h" +#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" @@ -509,9 +510,9 @@ void PromoteMem2Reg::run() { for (DenseMap<std::pair<BasicBlock*, unsigned>, PHINode*>::iterator I = NewPhiNodes.begin(), E = NewPhiNodes.end(); I != E;) { PHINode *PN = I->second; - + // If this PHI node merges one value and/or undefs, get the value. - if (Value *V = PN->hasConstantValue(&DT)) { + if (Value *V = SimplifyInstruction(PN, 0, &DT)) { if (AST && PN->getType()->isPointerTy()) AST->deleteValue(PN); PN->replaceAllUsesWith(V); |