Skip to content

Commit 15a1287

Browse files
committed
Pull LLVMContext out of PromoteMemToReg.
llvm-svn: 89645
1 parent 621fe56 commit 15a1287

File tree

6 files changed

+9
-15
lines changed

6 files changed

+9
-15
lines changed

llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class AllocaInst;
2323
class DominatorTree;
2424
class DominanceFrontier;
2525
class AliasSetTracker;
26-
class LLVMContext;
2726

2827
/// isAllocaPromotable - Return true if this alloca is legal for promotion.
2928
/// This is true if there are only loads and stores to the alloca...
@@ -40,7 +39,6 @@ bool isAllocaPromotable(const AllocaInst *AI);
4039
///
4140
void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas,
4241
DominatorTree &DT, DominanceFrontier &DF,
43-
LLVMContext &Context,
4442
AliasSetTracker *AST = 0);
4543

4644
} // End llvm namespace

llvm/lib/CodeGen/DwarfEHPrepare.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ bool DwarfEHPrepare::PromoteStackTemporaries() {
332332
if (ExceptionValueVar && DT && DF && isAllocaPromotable(ExceptionValueVar)) {
333333
// Turn the exception temporary into registers and phi nodes if possible.
334334
std::vector<AllocaInst*> Allocas(1, ExceptionValueVar);
335-
PromoteMemToReg(Allocas, *DT, *DF, ExceptionValueVar->getContext());
335+
PromoteMemToReg(Allocas, *DT, *DF);
336336
return true;
337337
}
338338
return false;

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void LICM::sink(Instruction &I) {
593593
if (AI) {
594594
std::vector<AllocaInst*> Allocas;
595595
Allocas.push_back(AI);
596-
PromoteMemToReg(Allocas, *DT, *DF, AI->getContext(), CurAST);
596+
PromoteMemToReg(Allocas, *DT, *DF, CurAST);
597597
}
598598
}
599599
}
@@ -769,7 +769,7 @@ void LICM::PromoteValuesInLoop() {
769769
PromotedAllocas.reserve(PromotedValues.size());
770770
for (unsigned i = 0, e = PromotedValues.size(); i != e; ++i)
771771
PromotedAllocas.push_back(PromotedValues[i].first);
772-
PromoteMemToReg(PromotedAllocas, *DT, *DF, Preheader->getContext(), CurAST);
772+
PromoteMemToReg(PromotedAllocas, *DT, *DF, CurAST);
773773
}
774774

775775
/// FindPromotableValuesInLoop - Check the current loop for stores to definite

llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ bool SROA::performPromotion(Function &F) {
192192

193193
if (Allocas.empty()) break;
194194

195-
PromoteMemToReg(Allocas, DT, DF, F.getContext());
195+
PromoteMemToReg(Allocas, DT, DF);
196196
NumPromoted += Allocas.size();
197197
Changed = true;
198198
}

llvm/lib/Transforms/Utils/Mem2Reg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bool PromotePass::runOnFunction(Function &F) {
7373

7474
if (Allocas.empty()) break;
7575

76-
PromoteMemToReg(Allocas, DT, DF, F.getContext());
76+
PromoteMemToReg(Allocas, DT, DF);
7777
NumPromoted += Allocas.size();
7878
Changed = true;
7979
}

llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "llvm/Function.h"
2424
#include "llvm/Instructions.h"
2525
#include "llvm/IntrinsicInst.h"
26-
#include "llvm/LLVMContext.h"
2726
#include "llvm/Analysis/Dominators.h"
2827
#include "llvm/Analysis/AliasSetTracker.h"
2928
#include "llvm/ADT/DenseMap.h"
@@ -180,8 +179,6 @@ namespace {
180179
///
181180
AliasSetTracker *AST;
182181

183-
LLVMContext &Context;
184-
185182
/// AllocaLookup - Reverse mapping of Allocas.
186183
///
187184
std::map<AllocaInst*, unsigned> AllocaLookup;
@@ -212,9 +209,8 @@ namespace {
212209
DenseMap<const BasicBlock*, unsigned> BBNumPreds;
213210
public:
214211
PromoteMem2Reg(const std::vector<AllocaInst*> &A, DominatorTree &dt,
215-
DominanceFrontier &df, AliasSetTracker *ast,
216-
LLVMContext &C)
217-
: Allocas(A), DT(dt), DF(df), AST(ast), Context(C) {}
212+
DominanceFrontier &df, AliasSetTracker *ast)
213+
: Allocas(A), DT(dt), DF(df), AST(ast) {}
218214

219215
void run();
220216

@@ -1003,9 +999,9 @@ void PromoteMem2Reg::RenamePass(BasicBlock *BB, BasicBlock *Pred,
1003999
///
10041000
void llvm::PromoteMemToReg(const std::vector<AllocaInst*> &Allocas,
10051001
DominatorTree &DT, DominanceFrontier &DF,
1006-
LLVMContext &Context, AliasSetTracker *AST) {
1002+
AliasSetTracker *AST) {
10071003
// If there is nothing to do, bail out...
10081004
if (Allocas.empty()) return;
10091005

1010-
PromoteMem2Reg(Allocas, DT, DF, AST, Context).run();
1006+
PromoteMem2Reg(Allocas, DT, DF, AST).run();
10111007
}

0 commit comments

Comments
 (0)