summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2017-04-28 19:55:38 +0000
committerDaniel Berlin <dberlin@dberlin.org>2017-04-28 19:55:38 +0000
commit4d0fe64ae304cc9c3235daa7c1ddd8b51b163ab3 (patch)
tree08fd126f85db9e1ea5d571f0686fe13fa2cc7310 /llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
parentb6681e2b4e82cb11bd21a7cbf01abea165f32508 (diff)
downloadbcm5719-llvm-4d0fe64ae304cc9c3235daa7c1ddd8b51b163ab3.tar.gz
bcm5719-llvm-4d0fe64ae304cc9c3235daa7c1ddd8b51b163ab3.zip
Kill off the old SimplifyInstruction API by converting remaining users.
llvm-svn: 301673
Diffstat (limited to 'llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index a33b85c4ee6..cdba982e664 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -225,10 +225,10 @@ struct PromoteMem2Reg {
std::vector<AllocaInst *> Allocas;
DominatorTree &DT;
DIBuilder DIB;
-
/// A cache of @llvm.assume intrinsics used by SimplifyInstruction.
AssumptionCache *AC;
+ const SimplifyQuery SQ;
/// Reverse mapping of Allocas.
DenseMap<AllocaInst *, unsigned> AllocaLookup;
@@ -270,7 +270,8 @@ public:
AssumptionCache *AC)
: Allocas(Allocas.begin(), Allocas.end()), DT(DT),
DIB(*DT.getRoot()->getParent()->getParent(), /*AllowUnresolved*/ false),
- AC(AC) {}
+ AC(AC), SQ(DT.getRoot()->getParent()->getParent()->getDataLayout(),
+ nullptr, &DT, AC) {}
void run();
@@ -673,8 +674,6 @@ void PromoteMem2Reg::run() {
A->eraseFromParent();
}
- const DataLayout &DL = F.getParent()->getDataLayout();
-
// Remove alloca's dbg.declare instrinsics from the function.
for (unsigned i = 0, e = AllocaDbgDeclares.size(); i != e; ++i)
if (DbgDeclareInst *DDI = AllocaDbgDeclares[i])
@@ -699,7 +698,7 @@ void PromoteMem2Reg::run() {
PHINode *PN = I->second;
// If this PHI node merges one value and/or undefs, get the value.
- if (Value *V = SimplifyInstruction(PN, DL, nullptr, &DT, AC)) {
+ if (Value *V = SimplifyInstruction(PN, SQ)) {
PN->replaceAllUsesWith(V);
PN->eraseFromParent();
NewPhiNodes.erase(I++);
OpenPOWER on IntegriCloud