[PM/AA] Remove all of the dead AliasAnalysis pointers being threaded

through APIs that are no longer necessary now that the update API has
been removed.

This will make changes to the AA interfaces significantly less
disruptive (I hope). Either way, it seems like a really nice cleanup.

llvm-svn: 242882
This commit is contained in:
Chandler Carruth
2015-07-22 09:52:54 +00:00
parent a1032a0f7c
commit 96ada25bf3
13 changed files with 63 additions and 96 deletions

View File

@@ -65,7 +65,7 @@ void llvm::DeleteDeadBlock(BasicBlock *BB) {
/// any single-entry PHI nodes in it, fold them away. This handles the case
/// when all entries to the PHI nodes in a block are guaranteed equal, such as
/// when the block has exactly one predecessor.
void llvm::FoldSingleEntryPHINodes(BasicBlock *BB, AliasAnalysis *AA,
void llvm::FoldSingleEntryPHINodes(BasicBlock *BB,
MemoryDependenceAnalysis *MemDep) {
if (!isa<PHINode>(BB->begin())) return;
@@ -106,7 +106,7 @@ bool llvm::DeleteDeadPHIs(BasicBlock *BB, const TargetLibraryInfo *TLI) {
/// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor,
/// if possible. The return value indicates success or failure.
bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DominatorTree *DT,
LoopInfo *LI, AliasAnalysis *AA,
LoopInfo *LI,
MemoryDependenceAnalysis *MemDep) {
// Don't merge away blocks who have their address taken.
if (BB->hasAddressTaken()) return false;
@@ -143,7 +143,7 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DominatorTree *DT,
// Begin by getting rid of unneeded PHIs.
if (isa<PHINode>(BB->front()))
FoldSingleEntryPHINodes(BB, AA, MemDep);
FoldSingleEntryPHINodes(BB, MemDep);
// Delete the unconditional branch from the predecessor...
PredBB->getInstList().pop_back();
@@ -391,7 +391,7 @@ static void UpdateAnalysisInformation(BasicBlock *OldBB, BasicBlock *NewBB,
/// from NewBB. This also updates AliasAnalysis, if available.
static void UpdatePHINodes(BasicBlock *OrigBB, BasicBlock *NewBB,
ArrayRef<BasicBlock *> Preds, BranchInst *BI,
AliasAnalysis *AA, bool HasLoopExit) {
bool HasLoopExit) {
// Otherwise, create a new PHI node in NewBB for each PHI node in OrigBB.
SmallPtrSet<BasicBlock *, 16> PredSet(Preds.begin(), Preds.end());
for (BasicBlock::iterator I = OrigBB->begin(); isa<PHINode>(I); ) {
@@ -472,17 +472,16 @@ static void UpdatePHINodes(BasicBlock *OrigBB, BasicBlock *NewBB,
///
BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB,
ArrayRef<BasicBlock *> Preds,
const char *Suffix, AliasAnalysis *AA,
DominatorTree *DT, LoopInfo *LI,
bool PreserveLCSSA) {
const char *Suffix, DominatorTree *DT,
LoopInfo *LI, bool PreserveLCSSA) {
// For the landingpads we need to act a bit differently.
// Delegate this work to the SplitLandingPadPredecessors.
if (BB->isLandingPad()) {
SmallVector<BasicBlock*, 2> NewBBs;
std::string NewName = std::string(Suffix) + ".split-lp";
SplitLandingPadPredecessors(BB, Preds, Suffix, NewName.c_str(),
NewBBs, AA, DT, LI, PreserveLCSSA);
SplitLandingPadPredecessors(BB, Preds, Suffix, NewName.c_str(), NewBBs, DT,
LI, PreserveLCSSA);
return NewBBs[0];
}
@@ -521,7 +520,7 @@ BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB,
HasLoopExit);
// Update the PHI nodes in BB with the values coming from NewBB.
UpdatePHINodes(BB, NewBB, Preds, BI, AA, HasLoopExit);
UpdatePHINodes(BB, NewBB, Preds, BI, HasLoopExit);
return NewBB;
}
@@ -542,8 +541,8 @@ void llvm::SplitLandingPadPredecessors(BasicBlock *OrigBB,
ArrayRef<BasicBlock *> Preds,
const char *Suffix1, const char *Suffix2,
SmallVectorImpl<BasicBlock *> &NewBBs,
AliasAnalysis *AA, DominatorTree *DT,
LoopInfo *LI, bool PreserveLCSSA) {
DominatorTree *DT, LoopInfo *LI,
bool PreserveLCSSA) {
assert(OrigBB->isLandingPad() && "Trying to split a non-landing pad!");
// Create a new basic block for OrigBB's predecessors listed in Preds. Insert
@@ -572,7 +571,7 @@ void llvm::SplitLandingPadPredecessors(BasicBlock *OrigBB,
HasLoopExit);
// Update the PHI nodes in OrigBB with the values coming from NewBB1.
UpdatePHINodes(OrigBB, NewBB1, Preds, BI1, AA, HasLoopExit);
UpdatePHINodes(OrigBB, NewBB1, Preds, BI1, HasLoopExit);
// Move the remaining edges from OrigBB to point to NewBB2.
SmallVector<BasicBlock*, 8> NewBB2Preds;
@@ -609,7 +608,7 @@ void llvm::SplitLandingPadPredecessors(BasicBlock *OrigBB,
PreserveLCSSA, HasLoopExit);
// Update the PHI nodes in OrigBB with the values coming from NewBB2.
UpdatePHINodes(OrigBB, NewBB2, NewBB2Preds, BI2, AA, HasLoopExit);
UpdatePHINodes(OrigBB, NewBB2, NewBB2Preds, BI2, HasLoopExit);
}
LandingPadInst *LPad = OrigBB->getLandingPadInst();