Revert 91280-91283, 91286-91289, 91291, 91293, 91295-91296. It apparently introduced a non-deterministic behavior in the optimizer somewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91598 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2009-12-17 09:39:49 +00:00
parent 90b5d04772
commit 04149f7ffd
6 changed files with 113 additions and 43 deletions

View File

@ -175,11 +175,11 @@ class IVUsers : public LoopPass {
ScalarEvolution *SE; ScalarEvolution *SE;
SmallPtrSet<Instruction*,16> Processed; SmallPtrSet<Instruction*,16> Processed;
public:
/// IVUses - A list of all tracked IV uses of induction variable expressions /// IVUses - A list of all tracked IV uses of induction variable expressions
/// we are interested in. /// we are interested in.
ilist<IVUsersOfOneStride> IVUses; ilist<IVUsersOfOneStride> IVUses;
public:
/// IVUsesByStride - A mapping from the strides in StrideOrder to the /// IVUsesByStride - A mapping from the strides in StrideOrder to the
/// uses in IVUses. /// uses in IVUses.
std::map<const SCEV *, IVUsersOfOneStride*> IVUsesByStride; std::map<const SCEV *, IVUsersOfOneStride*> IVUsesByStride;

View File

@ -976,6 +976,13 @@ public:
void removeBlock(BasicBlock *BB) { void removeBlock(BasicBlock *BB) {
LI.removeBlock(BB); LI.removeBlock(BB);
} }
static bool isNotAlreadyContainedIn(const Loop *SubLoop,
const Loop *ParentLoop) {
return
LoopInfoBase<BasicBlock, Loop>::isNotAlreadyContainedIn(SubLoop,
ParentLoop);
}
}; };

View File

@ -53,7 +53,7 @@ static bool containsAddRecFromDifferentLoop(const SCEV *S, Loop *L) {
if (newLoop == L) if (newLoop == L)
return false; return false;
// if newLoop is an outer loop of L, this is OK. // if newLoop is an outer loop of L, this is OK.
if (newLoop->contains(L->getHeader())) if (!LoopInfo::isNotAlreadyContainedIn(L, newLoop))
return false; return false;
} }
return true; return true;
@ -307,7 +307,6 @@ bool IVUsers::runOnLoop(Loop *l, LPPassManager &LPM) {
for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I) for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I)
AddUsersIfInteresting(I); AddUsersIfInteresting(I);
Processed.clear();
return false; return false;
} }
@ -370,7 +369,7 @@ void IVUsers::dump() const {
void IVUsers::releaseMemory() { void IVUsers::releaseMemory() {
IVUsesByStride.clear(); IVUsesByStride.clear();
StrideOrder.clear(); StrideOrder.clear();
IVUses.clear(); Processed.clear();
} }
void IVStrideUse::deleted() { void IVStrideUse::deleted() {

View File

@ -31,6 +31,10 @@ namespace llvm {
bool EnableFastISel; bool EnableFastISel;
} }
static cl::opt<bool> X1("x1");
static cl::opt<bool> X2("x2");
static cl::opt<bool> X3("x3");
static cl::opt<bool> X4("x4");
static cl::opt<bool> DisablePostRA("disable-post-ra", cl::Hidden, static cl::opt<bool> DisablePostRA("disable-post-ra", cl::Hidden,
cl::desc("Disable Post Regalloc")); cl::desc("Disable Post Regalloc"));
static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden, static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden,
@ -239,6 +243,11 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
PM.add(createGVNPass(/*NoPRE=*/false, /*NoLoads=*/true)); PM.add(createGVNPass(/*NoPRE=*/false, /*NoLoads=*/true));
} }
if (X1)
PM.add(createPrintFunctionPass("\n\n"
"*** Before LSR ***\n",
&errs()));
// Run loop strength reduction before anything else. // Run loop strength reduction before anything else.
if (OptLevel != CodeGenOpt::None && !DisableLSR) { if (OptLevel != CodeGenOpt::None && !DisableLSR) {
PM.add(createLoopStrengthReducePass(getTargetLowering())); PM.add(createLoopStrengthReducePass(getTargetLowering()));
@ -246,6 +255,11 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &errs())); PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &errs()));
} }
if (X2)
PM.add(createPrintFunctionPass("\n\n"
"*** After LSR ***\n",
&errs()));
// Turn exception handling constructs into something the code generators can // Turn exception handling constructs into something the code generators can
// handle. // handle.
switch (getMCAsmInfo()->getExceptionHandlingType()) switch (getMCAsmInfo()->getExceptionHandlingType())
@ -268,9 +282,19 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
// Make sure that no unreachable blocks are instruction selected. // Make sure that no unreachable blocks are instruction selected.
PM.add(createUnreachableBlockEliminationPass()); PM.add(createUnreachableBlockEliminationPass());
if (X3)
PM.add(createPrintFunctionPass("\n\n"
"*** Before CGP ***\n",
&errs()));
if (OptLevel != CodeGenOpt::None && !DisableCGP) if (OptLevel != CodeGenOpt::None && !DisableCGP)
PM.add(createCodeGenPreparePass(getTargetLowering())); PM.add(createCodeGenPreparePass(getTargetLowering()));
if (X4)
PM.add(createPrintFunctionPass("\n\n"
"*** After CGP ***\n",
&errs()));
PM.add(createStackProtectorPass(getTargetLowering())); PM.add(createStackProtectorPass(getTargetLowering()));
if (PrintISelInput) if (PrintISelInput)

View File

@ -48,7 +48,7 @@ namespace {
/// TLI - Keep a pointer of a TargetLowering to consult for determining /// TLI - Keep a pointer of a TargetLowering to consult for determining
/// transformation profitability. /// transformation profitability.
const TargetLowering *TLI; const TargetLowering *TLI;
ProfileInfo *PI; ProfileInfo *PFI;
/// BackEdges - Keep a set of all the loop back edges. /// BackEdges - Keep a set of all the loop back edges.
/// ///
@ -99,7 +99,7 @@ void CodeGenPrepare::findLoopBackEdges(const Function &F) {
bool CodeGenPrepare::runOnFunction(Function &F) { bool CodeGenPrepare::runOnFunction(Function &F) {
bool EverMadeChange = false; bool EverMadeChange = false;
PI = getAnalysisIfAvailable<ProfileInfo>(); PFI = getAnalysisIfAvailable<ProfileInfo>();
// First pass, eliminate blocks that contain only PHI nodes and an // First pass, eliminate blocks that contain only PHI nodes and an
// unconditional branch. // unconditional branch.
EverMadeChange |= EliminateMostlyEmptyBlocks(F); EverMadeChange |= EliminateMostlyEmptyBlocks(F);
@ -288,9 +288,9 @@ void CodeGenPrepare::EliminateMostlyEmptyBlock(BasicBlock *BB) {
// The PHIs are now updated, change everything that refers to BB to use // The PHIs are now updated, change everything that refers to BB to use
// DestBB and remove BB. // DestBB and remove BB.
BB->replaceAllUsesWith(DestBB); BB->replaceAllUsesWith(DestBB);
if (PI) { if (PFI) {
PI->replaceAllUses(BB, DestBB); PFI->replaceAllUses(BB, DestBB);
PI->removeEdge(ProfileInfo::getEdge(BB, DestBB)); PFI->removeEdge(ProfileInfo::getEdge(BB, DestBB));
} }
BB->eraseFromParent(); BB->eraseFromParent();
@ -368,9 +368,9 @@ static void SplitEdgeNicely(TerminatorInst *TI, unsigned SuccNum,
// If we found a workable predecessor, change TI to branch to Succ. // If we found a workable predecessor, change TI to branch to Succ.
if (FoundMatch) { if (FoundMatch) {
ProfileInfo *PI = P->getAnalysisIfAvailable<ProfileInfo>(); ProfileInfo *PFI = P->getAnalysisIfAvailable<ProfileInfo>();
if (PI) if (PFI)
PI->splitEdge(TIBB, Dest, Pred); PFI->splitEdge(TIBB, Dest, Pred);
Dest->removePredecessor(TIBB); Dest->removePredecessor(TIBB);
TI->setSuccessor(SuccNum, Pred); TI->setSuccessor(SuccNum, Pred);
return; return;

View File

@ -24,14 +24,18 @@
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/Instructions.h" #include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h" #include "llvm/IntrinsicInst.h"
#include "llvm/Type.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/IVUsers.h" #include "llvm/Analysis/IVUsers.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Transforms/Utils/AddrModeMatcher.h" #include "llvm/Transforms/Utils/AddrModeMatcher.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/ValueHandle.h" #include "llvm/Support/ValueHandle.h"
@ -81,6 +85,8 @@ namespace {
class LoopStrengthReduce : public LoopPass { class LoopStrengthReduce : public LoopPass {
IVUsers *IU; IVUsers *IU;
LoopInfo *LI;
DominatorTree *DT;
ScalarEvolution *SE; ScalarEvolution *SE;
bool Changed; bool Changed;
@ -88,6 +94,10 @@ namespace {
/// particular stride. /// particular stride.
std::map<const SCEV *, IVsOfOneStride> IVsByStride; std::map<const SCEV *, IVsOfOneStride> IVsByStride;
/// StrideNoReuse - Keep track of all the strides whose ivs cannot be
/// reused (nor should they be rewritten to reuse other strides).
SmallSet<const SCEV *, 4> StrideNoReuse;
/// DeadInsts - Keep track of instructions we may have made dead, so that /// DeadInsts - Keep track of instructions we may have made dead, so that
/// we can remove them after we are done working. /// we can remove them after we are done working.
SmallVector<WeakVH, 16> DeadInsts; SmallVector<WeakVH, 16> DeadInsts;
@ -99,7 +109,8 @@ namespace {
public: public:
static char ID; // Pass ID, replacement for typeid static char ID; // Pass ID, replacement for typeid
explicit LoopStrengthReduce(const TargetLowering *tli = NULL) : explicit LoopStrengthReduce(const TargetLowering *tli = NULL) :
LoopPass(&ID), TLI(tli) {} LoopPass(&ID), TLI(tli) {
}
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM);
@ -107,11 +118,13 @@ namespace {
// We split critical edges, so we change the CFG. However, we do update // We split critical edges, so we change the CFG. However, we do update
// many analyses if they are around. // many analyses if they are around.
AU.addPreservedID(LoopSimplifyID); AU.addPreservedID(LoopSimplifyID);
AU.addPreserved("loops"); AU.addPreserved<LoopInfo>();
AU.addPreserved("domfrontier"); AU.addPreserved<DominanceFrontier>();
AU.addPreserved("domtree"); AU.addPreserved<DominatorTree>();
AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LoopSimplifyID);
AU.addRequired<LoopInfo>();
AU.addRequired<DominatorTree>();
AU.addRequired<ScalarEvolution>(); AU.addRequired<ScalarEvolution>();
AU.addPreserved<ScalarEvolution>(); AU.addPreserved<ScalarEvolution>();
AU.addRequired<IVUsers>(); AU.addRequired<IVUsers>();
@ -215,17 +228,19 @@ void LoopStrengthReduce::DeleteTriviallyDeadInstructions() {
if (DeadInsts.empty()) return; if (DeadInsts.empty()) return;
while (!DeadInsts.empty()) { while (!DeadInsts.empty()) {
Instruction *I = dyn_cast_or_null<Instruction>(DeadInsts.pop_back_val()); Instruction *I = dyn_cast_or_null<Instruction>(DeadInsts.back());
DeadInsts.pop_back();
if (I == 0 || !isInstructionTriviallyDead(I)) if (I == 0 || !isInstructionTriviallyDead(I))
continue; continue;
for (User::op_iterator OI = I->op_begin(), E = I->op_end(); OI != E; ++OI) for (User::op_iterator OI = I->op_begin(), E = I->op_end(); OI != E; ++OI) {
if (Instruction *U = dyn_cast<Instruction>(*OI)) { if (Instruction *U = dyn_cast<Instruction>(*OI)) {
*OI = 0; *OI = 0;
if (U->use_empty()) if (U->use_empty())
DeadInsts.push_back(U); DeadInsts.push_back(U);
} }
}
I->eraseFromParent(); I->eraseFromParent();
Changed = true; Changed = true;
@ -285,6 +300,9 @@ namespace {
/// BasedUser - For a particular base value, keep information about how we've /// BasedUser - For a particular base value, keep information about how we've
/// partitioned the expression so far. /// partitioned the expression so far.
struct BasedUser { struct BasedUser {
/// SE - The current ScalarEvolution object.
ScalarEvolution *SE;
/// Base - The Base value for the PHI node that needs to be inserted for /// Base - The Base value for the PHI node that needs to be inserted for
/// this use. As the use is processed, information gets moved from this /// this use. As the use is processed, information gets moved from this
/// field to the Imm field (below). BasedUser values are sorted by this /// field to the Imm field (below). BasedUser values are sorted by this
@ -316,9 +334,9 @@ namespace {
bool isUseOfPostIncrementedValue; bool isUseOfPostIncrementedValue;
BasedUser(IVStrideUse &IVSU, ScalarEvolution *se) BasedUser(IVStrideUse &IVSU, ScalarEvolution *se)
: Base(IVSU.getOffset()), Inst(IVSU.getUser()), : SE(se), Base(IVSU.getOffset()), Inst(IVSU.getUser()),
OperandValToReplace(IVSU.getOperandValToReplace()), OperandValToReplace(IVSU.getOperandValToReplace()),
Imm(se->getIntegerSCEV(0, Base->getType())), Imm(SE->getIntegerSCEV(0, Base->getType())),
isUseOfPostIncrementedValue(IVSU.isUseOfPostIncrementedValue()) {} isUseOfPostIncrementedValue(IVSU.isUseOfPostIncrementedValue()) {}
// Once we rewrite the code to insert the new IVs we want, update the // Once we rewrite the code to insert the new IVs we want, update the
@ -327,14 +345,14 @@ namespace {
void RewriteInstructionToUseNewBase(const SCEV *const &NewBase, void RewriteInstructionToUseNewBase(const SCEV *const &NewBase,
Instruction *InsertPt, Instruction *InsertPt,
SCEVExpander &Rewriter, Loop *L, Pass *P, SCEVExpander &Rewriter, Loop *L, Pass *P,
SmallVectorImpl<WeakVH> &DeadInsts, LoopInfo &LI,
ScalarEvolution *SE); SmallVectorImpl<WeakVH> &DeadInsts);
Value *InsertCodeForBaseAtPosition(const SCEV *const &NewBase, Value *InsertCodeForBaseAtPosition(const SCEV *const &NewBase,
const Type *Ty, const Type *Ty,
SCEVExpander &Rewriter, SCEVExpander &Rewriter,
Instruction *IP, Instruction *IP, Loop *L,
ScalarEvolution *SE); LoopInfo &LI);
void dump() const; void dump() const;
}; };
} }
@ -348,12 +366,27 @@ void BasedUser::dump() const {
Value *BasedUser::InsertCodeForBaseAtPosition(const SCEV *const &NewBase, Value *BasedUser::InsertCodeForBaseAtPosition(const SCEV *const &NewBase,
const Type *Ty, const Type *Ty,
SCEVExpander &Rewriter, SCEVExpander &Rewriter,
Instruction *IP, Instruction *IP, Loop *L,
ScalarEvolution *SE) { LoopInfo &LI) {
Value *Base = Rewriter.expandCodeFor(NewBase, 0, IP); // Figure out where we *really* want to insert this code. In particular, if
// the user is inside of a loop that is nested inside of L, we really don't
// want to insert this expression before the user, we'd rather pull it out as
// many loops as possible.
Instruction *BaseInsertPt = IP;
// Figure out the most-nested loop that IP is in.
Loop *InsertLoop = LI.getLoopFor(IP->getParent());
// If InsertLoop is not L, and InsertLoop is nested inside of L, figure out
// the preheader of the outer-most loop where NewBase is not loop invariant.
if (L->contains(IP->getParent()))
while (InsertLoop && NewBase->isLoopInvariant(InsertLoop)) {
BaseInsertPt = InsertLoop->getLoopPreheader()->getTerminator();
InsertLoop = InsertLoop->getParentLoop();
}
Value *Base = Rewriter.expandCodeFor(NewBase, 0, BaseInsertPt);
// Wrap the base in a SCEVUnknown so that ScalarEvolution doesn't try to
// re-analyze it.
const SCEV *NewValSCEV = SE->getUnknown(Base); const SCEV *NewValSCEV = SE->getUnknown(Base);
// Always emit the immediate into the same block as the user. // Always emit the immediate into the same block as the user.
@ -372,8 +405,8 @@ Value *BasedUser::InsertCodeForBaseAtPosition(const SCEV *const &NewBase,
void BasedUser::RewriteInstructionToUseNewBase(const SCEV *const &NewBase, void BasedUser::RewriteInstructionToUseNewBase(const SCEV *const &NewBase,
Instruction *NewBasePt, Instruction *NewBasePt,
SCEVExpander &Rewriter, Loop *L, Pass *P, SCEVExpander &Rewriter, Loop *L, Pass *P,
SmallVectorImpl<WeakVH> &DeadInsts, LoopInfo &LI,
ScalarEvolution *SE) { SmallVectorImpl<WeakVH> &DeadInsts) {
if (!isa<PHINode>(Inst)) { if (!isa<PHINode>(Inst)) {
// By default, insert code at the user instruction. // By default, insert code at the user instruction.
BasicBlock::iterator InsertPt = Inst; BasicBlock::iterator InsertPt = Inst;
@ -402,7 +435,7 @@ void BasedUser::RewriteInstructionToUseNewBase(const SCEV *const &NewBase,
} }
Value *NewVal = InsertCodeForBaseAtPosition(NewBase, Value *NewVal = InsertCodeForBaseAtPosition(NewBase,
OperandValToReplace->getType(), OperandValToReplace->getType(),
Rewriter, InsertPt, SE); Rewriter, InsertPt, L, LI);
// Replace the use of the operand Value with the new Phi we just created. // Replace the use of the operand Value with the new Phi we just created.
Inst->replaceUsesOfWith(OperandValToReplace, NewVal); Inst->replaceUsesOfWith(OperandValToReplace, NewVal);
@ -464,7 +497,7 @@ void BasedUser::RewriteInstructionToUseNewBase(const SCEV *const &NewBase,
PHIPred->getTerminator() : PHIPred->getTerminator() :
OldLoc->getParent()->getTerminator(); OldLoc->getParent()->getTerminator();
Code = InsertCodeForBaseAtPosition(NewBase, PN->getType(), Code = InsertCodeForBaseAtPosition(NewBase, PN->getType(),
Rewriter, InsertPt, SE); Rewriter, InsertPt, L, LI);
DEBUG(errs() << " Changing PHI use to "); DEBUG(errs() << " Changing PHI use to ");
DEBUG(WriteAsOperand(errs(), Code, /*PrintType=*/false)); DEBUG(WriteAsOperand(errs(), Code, /*PrintType=*/false));
@ -940,13 +973,17 @@ const SCEV *LoopStrengthReduce::CheckForIVReuse(bool HasBaseReg,
const SCEV *const &Stride, const SCEV *const &Stride,
IVExpr &IV, const Type *Ty, IVExpr &IV, const Type *Ty,
const std::vector<BasedUser>& UsersToProcess) { const std::vector<BasedUser>& UsersToProcess) {
if (StrideNoReuse.count(Stride))
return SE->getIntegerSCEV(0, Stride->getType());
if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(Stride)) { if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(Stride)) {
int64_t SInt = SC->getValue()->getSExtValue(); int64_t SInt = SC->getValue()->getSExtValue();
for (unsigned NewStride = 0, e = IU->StrideOrder.size(); for (unsigned NewStride = 0, e = IU->StrideOrder.size();
NewStride != e; ++NewStride) { NewStride != e; ++NewStride) {
std::map<const SCEV *, IVsOfOneStride>::iterator SI = std::map<const SCEV *, IVsOfOneStride>::iterator SI =
IVsByStride.find(IU->StrideOrder[NewStride]); IVsByStride.find(IU->StrideOrder[NewStride]);
if (SI == IVsByStride.end() || !isa<SCEVConstant>(SI->first)) if (SI == IVsByStride.end() || !isa<SCEVConstant>(SI->first) ||
StrideNoReuse.count(SI->first))
continue; continue;
// The other stride has no uses, don't reuse it. // The other stride has no uses, don't reuse it.
std::map<const SCEV *, IVUsersOfOneStride *>::iterator UI = std::map<const SCEV *, IVUsersOfOneStride *>::iterator UI =
@ -1705,8 +1742,8 @@ LoopStrengthReduce::StrengthReduceIVUsersOfStride(const SCEV *const &Stride,
RewriteExpr = SE->getAddExpr(RewriteExpr, SE->getUnknown(BaseV)); RewriteExpr = SE->getAddExpr(RewriteExpr, SE->getUnknown(BaseV));
User.RewriteInstructionToUseNewBase(RewriteExpr, NewBasePt, User.RewriteInstructionToUseNewBase(RewriteExpr, NewBasePt,
Rewriter, L, this, Rewriter, L, this, *LI,
DeadInsts, SE); DeadInsts);
// Mark old value we replaced as possibly dead, so that it is eliminated // Mark old value we replaced as possibly dead, so that it is eliminated
// if we just replaced the last use of that value. // if we just replaced the last use of that value.
@ -2670,6 +2707,8 @@ bool LoopStrengthReduce::OptimizeLoopCountIV(Loop *L) {
bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) { bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) {
IU = &getAnalysis<IVUsers>(); IU = &getAnalysis<IVUsers>();
LI = &getAnalysis<LoopInfo>();
DT = &getAnalysis<DominatorTree>();
SE = &getAnalysis<ScalarEvolution>(); SE = &getAnalysis<ScalarEvolution>();
Changed = false; Changed = false;
@ -2715,15 +2754,16 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) {
// After all sharing is done, see if we can adjust the loop to test against // After all sharing is done, see if we can adjust the loop to test against
// zero instead of counting up to a maximum. This is usually faster. // zero instead of counting up to a maximum. This is usually faster.
OptimizeLoopCountIV(L); OptimizeLoopCountIV(L);
// We're done analyzing this loop; release all the state we built up for it.
IVsByStride.clear();
// Clean up after ourselves
if (!DeadInsts.empty())
DeleteTriviallyDeadInstructions();
} }
// We're done analyzing this loop; release all the state we built up for it.
IVsByStride.clear();
StrideNoReuse.clear();
// Clean up after ourselves
if (!DeadInsts.empty())
DeleteTriviallyDeadInstructions();
// At this point, it is worth checking to see if any recurrence PHIs are also // At this point, it is worth checking to see if any recurrence PHIs are also
// dead, so that we can remove them as well. // dead, so that we can remove them as well.
DeleteDeadPHIs(L->getHeader()); DeleteDeadPHIs(L->getHeader());