summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2016-12-15 03:02:15 +0000
committerHal Finkel <hfinkel@anl.gov>2016-12-15 03:02:15 +0000
commit3ca4a6bcf11d6b4ac34fed640f3ab23995ec1877 (patch)
tree4594d31d24d9535dd4f5198505a25dd88c0f8fb5 /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parentcb9f78e1c3951337de4ba24902eced2c72184319 (diff)
downloadbcm5719-llvm-3ca4a6bcf11d6b4ac34fed640f3ab23995ec1877.tar.gz
bcm5719-llvm-3ca4a6bcf11d6b4ac34fed640f3ab23995ec1877.zip
Remove the AssumptionCache
After r289755, the AssumptionCache is no longer needed. Variables affected by assumptions are now found by using the new operand-bundle-based scheme. This new scheme is more computationally efficient, and also we need much less code... llvm-svn: 289756
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 00cda2af00c..176de0cf153 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -46,7 +46,6 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
-#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/DependenceAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/InstructionSimplify.h"
@@ -204,13 +203,12 @@ static void addBlockAndPredsToSet(BasicBlock *InputBB, BasicBlock *StopBlock,
/// \brief The first part of loop-nestification is to find a PHI node that tells
/// us how to partition the loops.
-static PHINode *findPHIToPartitionLoops(Loop *L, DominatorTree *DT,
- AssumptionCache *AC) {
+static PHINode *findPHIToPartitionLoops(Loop *L, DominatorTree *DT) {
const DataLayout &DL = L->getHeader()->getModule()->getDataLayout();
for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ) {
PHINode *PN = cast<PHINode>(I);
++I;
- if (Value *V = SimplifyInstruction(PN, DL, nullptr, DT, AC)) {
+ if (Value *V = SimplifyInstruction(PN, DL, nullptr, DT)) {
// This is a degenerate PHI already, don't modify it!
PN->replaceAllUsesWith(V);
PN->eraseFromParent();
@@ -248,8 +246,7 @@ static PHINode *findPHIToPartitionLoops(Loop *L, DominatorTree *DT,
///
static Loop *separateNestedLoop(Loop *L, BasicBlock *Preheader,
DominatorTree *DT, LoopInfo *LI,
- ScalarEvolution *SE, bool PreserveLCSSA,
- AssumptionCache *AC) {
+ ScalarEvolution *SE, bool PreserveLCSSA) {
// Don't try to separate loops without a preheader.
if (!Preheader)
return nullptr;
@@ -258,7 +255,7 @@ static Loop *separateNestedLoop(Loop *L, BasicBlock *Preheader,
BasicBlock *Header = L->getHeader();
assert(!Header->isEHPad() && "Can't insert backedge to EH pad");
- PHINode *PN = findPHIToPartitionLoops(L, DT, AC);
+ PHINode *PN = findPHIToPartitionLoops(L, DT);
if (!PN) return nullptr; // No known way to partition.
// Pull out all predecessors that have varying values in the loop. This
@@ -501,8 +498,7 @@ static BasicBlock *insertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader,
/// \brief Simplify one loop and queue further loops for simplification.
static bool simplifyOneLoop(Loop *L, SmallVectorImpl<Loop *> &Worklist,
DominatorTree *DT, LoopInfo *LI,
- ScalarEvolution *SE, AssumptionCache *AC,
- bool PreserveLCSSA) {
+ ScalarEvolution *SE, bool PreserveLCSSA) {
bool Changed = false;
ReprocessLoop:
@@ -596,7 +592,7 @@ ReprocessLoop:
// common backedge instead.
if (L->getNumBackEdges() < 8) {
if (Loop *OuterL =
- separateNestedLoop(L, Preheader, DT, LI, SE, PreserveLCSSA, AC)) {
+ separateNestedLoop(L, Preheader, DT, LI, SE, PreserveLCSSA)) {
++NumNested;
// Enqueue the outer loop as it should be processed next in our
// depth-first nest walk.
@@ -628,7 +624,7 @@ ReprocessLoop:
PHINode *PN;
for (BasicBlock::iterator I = L->getHeader()->begin();
(PN = dyn_cast<PHINode>(I++)); )
- if (Value *V = SimplifyInstruction(PN, DL, nullptr, DT, AC)) {
+ if (Value *V = SimplifyInstruction(PN, DL, nullptr, DT)) {
if (SE) SE->forgetValue(PN);
if (!PreserveLCSSA || LI->replacementPreservesLCSSAForm(PN, V)) {
PN->replaceAllUsesWith(V);
@@ -731,8 +727,7 @@ ReprocessLoop:
}
bool llvm::simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI,
- ScalarEvolution *SE, AssumptionCache *AC,
- bool PreserveLCSSA) {
+ ScalarEvolution *SE, bool PreserveLCSSA) {
bool Changed = false;
// Worklist maintains our depth-first queue of loops in this nest to process.
@@ -749,7 +744,7 @@ bool llvm::simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI,
while (!Worklist.empty())
Changed |= simplifyOneLoop(Worklist.pop_back_val(), Worklist, DT, LI, SE,
- AC, PreserveLCSSA);
+ PreserveLCSSA);
return Changed;
}
@@ -764,8 +759,6 @@ namespace {
bool runOnFunction(Function &F) override;
void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.addRequired<AssumptionCacheTracker>();
-
// We need loop information to identify the loops...
AU.addRequired<DominatorTreeWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>();
@@ -791,7 +784,6 @@ namespace {
char LoopSimplify::ID = 0;
INITIALIZE_PASS_BEGIN(LoopSimplify, "loop-simplify",
"Canonicalize natural loops", false, false)
-INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
INITIALIZE_PASS_END(LoopSimplify, "loop-simplify",
@@ -810,8 +802,6 @@ bool LoopSimplify::runOnFunction(Function &F) {
DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
auto *SEWP = getAnalysisIfAvailable<ScalarEvolutionWrapperPass>();
ScalarEvolution *SE = SEWP ? &SEWP->getSE() : nullptr;
- AssumptionCache *AC =
- &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
bool PreserveLCSSA = mustPreserveAnalysisID(LCSSAID);
#ifndef NDEBUG
@@ -826,7 +816,7 @@ bool LoopSimplify::runOnFunction(Function &F) {
// Simplify each loop nest in the function.
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
- Changed |= simplifyLoop(*I, DT, LI, SE, AC, PreserveLCSSA);
+ Changed |= simplifyLoop(*I, DT, LI, SE, PreserveLCSSA);
#ifndef NDEBUG
if (PreserveLCSSA) {
@@ -844,12 +834,11 @@ PreservedAnalyses LoopSimplifyPass::run(Function &F,
LoopInfo *LI = &AM.getResult<LoopAnalysis>(F);
DominatorTree *DT = &AM.getResult<DominatorTreeAnalysis>(F);
ScalarEvolution *SE = AM.getCachedResult<ScalarEvolutionAnalysis>(F);
- AssumptionCache *AC = &AM.getResult<AssumptionAnalysis>(F);
// FIXME: This pass should verify that the loops on which it's operating
// are in canonical SSA form, and that the pass itself preserves this form.
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
- Changed |= simplifyLoop(*I, DT, LI, SE, AC, true /* PreserveLCSSA */);
+ Changed |= simplifyLoop(*I, DT, LI, SE, true /* PreserveLCSSA */);
// FIXME: We need to invalidate this to avoid PR28400. Is there a better
// solution?
OpenPOWER on IntegriCloud