mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
[Mem2Reg] Remove AliasSetTracker updating logic from the pass.
No caller has been passing it for a long time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299827 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d0196ef8d2
commit
619694e7af
@ -38,10 +38,7 @@ bool isAllocaPromotable(const AllocaInst *AI);
|
||||
/// does not modify the CFG of the function at all. All allocas must be from
|
||||
/// the same function.
|
||||
///
|
||||
/// If AST is specified, the specified tracker is updated to reflect changes
|
||||
/// made to the IR.
|
||||
void PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
|
||||
AliasSetTracker *AST = nullptr,
|
||||
AssumptionCache *AC = nullptr);
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -4189,7 +4189,7 @@ bool SROA::promoteAllocas(Function &F) {
|
||||
NumPromoted += PromotableAllocas.size();
|
||||
|
||||
DEBUG(dbgs() << "Promoting allocas with mem2reg...\n");
|
||||
PromoteMemToReg(PromotableAllocas, *DT, nullptr, AC);
|
||||
PromoteMemToReg(PromotableAllocas, *DT, AC);
|
||||
PromotableAllocas.clear();
|
||||
return true;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ static bool promoteMemoryToRegister(Function &F, DominatorTree &DT,
|
||||
if (Allocas.empty())
|
||||
break;
|
||||
|
||||
PromoteMemToReg(Allocas, DT, nullptr, &AC);
|
||||
PromoteMemToReg(Allocas, DT, &AC);
|
||||
NumPromoted += Allocas.size();
|
||||
Changed = true;
|
||||
}
|
||||
|
@ -226,9 +226,6 @@ struct PromoteMem2Reg {
|
||||
DominatorTree &DT;
|
||||
DIBuilder DIB;
|
||||
|
||||
/// An AliasSetTracker object to update. If null, don't update it.
|
||||
AliasSetTracker *AST;
|
||||
|
||||
/// A cache of @llvm.assume intrinsics used by SimplifyInstruction.
|
||||
AssumptionCache *AC;
|
||||
|
||||
@ -270,10 +267,10 @@ struct PromoteMem2Reg {
|
||||
|
||||
public:
|
||||
PromoteMem2Reg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
|
||||
AliasSetTracker *AST, AssumptionCache *AC)
|
||||
AssumptionCache *AC)
|
||||
: Allocas(Allocas.begin(), Allocas.end()), DT(DT),
|
||||
DIB(*DT.getRoot()->getParent()->getParent(), /*AllowUnresolved*/ false),
|
||||
AST(AST), AC(AC) {}
|
||||
AC(AC) {}
|
||||
|
||||
void run();
|
||||
|
||||
@ -348,7 +345,6 @@ static void removeLifetimeIntrinsicUsers(AllocaInst *AI) {
|
||||
/// promotion algorithm in that case.
|
||||
static bool rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info,
|
||||
LargeBlockInfo &LBI, DominatorTree &DT,
|
||||
AliasSetTracker *AST,
|
||||
AssumptionCache *AC) {
|
||||
StoreInst *OnlyStore = Info.OnlyStore;
|
||||
bool StoringGlobalVal = !isa<Instruction>(OnlyStore->getOperand(0));
|
||||
@ -409,8 +405,6 @@ static bool rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info,
|
||||
addAssumeNonNull(AC, LI);
|
||||
|
||||
LI->replaceAllUsesWith(ReplVal);
|
||||
if (AST && LI->getType()->isPointerTy())
|
||||
AST->deleteValue(LI);
|
||||
LI->eraseFromParent();
|
||||
LBI.deleteValue(LI);
|
||||
}
|
||||
@ -431,8 +425,6 @@ static bool rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info,
|
||||
Info.OnlyStore->eraseFromParent();
|
||||
LBI.deleteValue(Info.OnlyStore);
|
||||
|
||||
if (AST)
|
||||
AST->deleteValue(AI);
|
||||
AI->eraseFromParent();
|
||||
LBI.deleteValue(AI);
|
||||
return true;
|
||||
@ -456,7 +448,6 @@ static bool rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info,
|
||||
/// }
|
||||
static bool promoteSingleBlockAlloca(AllocaInst *AI, const AllocaInfo &Info,
|
||||
LargeBlockInfo &LBI,
|
||||
AliasSetTracker *AST,
|
||||
DominatorTree &DT,
|
||||
AssumptionCache *AC) {
|
||||
// The trickiest case to handle is when we have large blocks. Because of this,
|
||||
@ -511,8 +502,6 @@ static bool promoteSingleBlockAlloca(AllocaInst *AI, const AllocaInfo &Info,
|
||||
LI->replaceAllUsesWith(ReplVal);
|
||||
}
|
||||
|
||||
if (AST && LI->getType()->isPointerTy())
|
||||
AST->deleteValue(LI);
|
||||
LI->eraseFromParent();
|
||||
LBI.deleteValue(LI);
|
||||
}
|
||||
@ -529,8 +518,6 @@ static bool promoteSingleBlockAlloca(AllocaInst *AI, const AllocaInfo &Info,
|
||||
LBI.deleteValue(SI);
|
||||
}
|
||||
|
||||
if (AST)
|
||||
AST->deleteValue(AI);
|
||||
AI->eraseFromParent();
|
||||
LBI.deleteValue(AI);
|
||||
|
||||
@ -547,8 +534,6 @@ static bool promoteSingleBlockAlloca(AllocaInst *AI, const AllocaInfo &Info,
|
||||
void PromoteMem2Reg::run() {
|
||||
Function &F = *DT.getRoot()->getParent();
|
||||
|
||||
if (AST)
|
||||
PointerAllocaValues.resize(Allocas.size());
|
||||
AllocaDbgDeclares.resize(Allocas.size());
|
||||
|
||||
AllocaInfo Info;
|
||||
@ -566,8 +551,6 @@ void PromoteMem2Reg::run() {
|
||||
|
||||
if (AI->use_empty()) {
|
||||
// If there are no uses of the alloca, just delete it now.
|
||||
if (AST)
|
||||
AST->deleteValue(AI);
|
||||
AI->eraseFromParent();
|
||||
|
||||
// Remove the alloca from the Allocas list, since it has been processed
|
||||
@ -583,7 +566,7 @@ void PromoteMem2Reg::run() {
|
||||
// If there is only a single store to this value, replace any loads of
|
||||
// it that are directly dominated by the definition with the value stored.
|
||||
if (Info.DefiningBlocks.size() == 1) {
|
||||
if (rewriteSingleStoreAlloca(AI, Info, LBI, DT, AST, AC)) {
|
||||
if (rewriteSingleStoreAlloca(AI, Info, LBI, DT, AC)) {
|
||||
// The alloca has been processed, move on.
|
||||
RemoveFromAllocasList(AllocaNum);
|
||||
++NumSingleStore;
|
||||
@ -594,7 +577,7 @@ void PromoteMem2Reg::run() {
|
||||
// If the alloca is only read and written in one basic block, just perform a
|
||||
// linear sweep over the block to eliminate it.
|
||||
if (Info.OnlyUsedInOneBlock &&
|
||||
promoteSingleBlockAlloca(AI, Info, LBI, AST, DT, AC)) {
|
||||
promoteSingleBlockAlloca(AI, Info, LBI, DT, AC)) {
|
||||
// The alloca has been processed, move on.
|
||||
RemoveFromAllocasList(AllocaNum);
|
||||
continue;
|
||||
@ -608,11 +591,6 @@ void PromoteMem2Reg::run() {
|
||||
BBNumbers[&BB] = ID++;
|
||||
}
|
||||
|
||||
// If we have an AST to keep updated, remember some pointer value that is
|
||||
// stored into the alloca.
|
||||
if (AST)
|
||||
PointerAllocaValues[AllocaNum] = Info.AllocaPointerVal;
|
||||
|
||||
// Remember the dbg.declare intrinsic describing this alloca, if any.
|
||||
if (Info.DbgDeclare)
|
||||
AllocaDbgDeclares[AllocaNum] = Info.DbgDeclare;
|
||||
@ -692,8 +670,6 @@ void PromoteMem2Reg::run() {
|
||||
// tree. Just delete the users now.
|
||||
if (!A->use_empty())
|
||||
A->replaceAllUsesWith(UndefValue::get(A->getType()));
|
||||
if (AST)
|
||||
AST->deleteValue(A);
|
||||
A->eraseFromParent();
|
||||
}
|
||||
|
||||
@ -724,8 +700,6 @@ void PromoteMem2Reg::run() {
|
||||
|
||||
// If this PHI node merges one value and/or undefs, get the value.
|
||||
if (Value *V = SimplifyInstruction(PN, DL, nullptr, &DT, AC)) {
|
||||
if (AST && PN->getType()->isPointerTy())
|
||||
AST->deleteValue(PN);
|
||||
PN->replaceAllUsesWith(V);
|
||||
PN->eraseFromParent();
|
||||
NewPhiNodes.erase(I++);
|
||||
@ -893,10 +867,6 @@ bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB, unsigned AllocaNo,
|
||||
&BB->front());
|
||||
++NumPHIInsert;
|
||||
PhiToAllocaMap[PN] = AllocaNo;
|
||||
|
||||
if (AST && PN->getType()->isPointerTy())
|
||||
AST->copyValue(PointerAllocaValues[AllocaNo], PN);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -979,8 +949,6 @@ NextIteration:
|
||||
|
||||
// Anything using the load now uses the current value.
|
||||
LI->replaceAllUsesWith(V);
|
||||
if (AST && LI->getType()->isPointerTy())
|
||||
AST->deleteValue(LI);
|
||||
BB->getInstList().erase(LI);
|
||||
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
|
||||
// Delete this instruction and mark the name as the current holder of the
|
||||
@ -1024,10 +992,10 @@ NextIteration:
|
||||
}
|
||||
|
||||
void llvm::PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
|
||||
AliasSetTracker *AST, AssumptionCache *AC) {
|
||||
AssumptionCache *AC) {
|
||||
// If there is nothing to do, bail out...
|
||||
if (Allocas.empty())
|
||||
return;
|
||||
|
||||
PromoteMem2Reg(Allocas, DT, AST, AC).run();
|
||||
PromoteMem2Reg(Allocas, DT, AC).run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user