summaryrefslogtreecommitdiffstats
path: root/polly/lib
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2014-11-30 14:33:31 +0000
committerTobias Grosser <tobias@grosser.es>2014-11-30 14:33:31 +0000
commit683b8e44627b7c64d623e29a5dd607df8f29f512 (patch)
treece42511e12fc059dd20cab974edeacb209de54aa /polly/lib
parent65b2b03fa4ca6b15cce8b871e40d7bc9139ab9f4 (diff)
downloadbcm5719-llvm-683b8e44627b7c64d623e29a5dd607df8f29f512.tar.gz
bcm5719-llvm-683b8e44627b7c64d623e29a5dd607df8f29f512.zip
Remove -polly-codegen-scev option and related code
SCEV based code generation has been the default for two weeks after having been tested for a long time. We now drop the support the non-scev-based code generation. llvm-svn: 222978
Diffstat (limited to 'polly/lib')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp15
-rw-r--r--polly/lib/Analysis/ScopDetectionDiagnostic.cpp37
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp16
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp29
-rw-r--r--polly/lib/CodeGen/CodeGeneration.cpp10
-rw-r--r--polly/lib/CodeGen/IslCodeGeneration.cpp9
-rw-r--r--polly/lib/Support/RegisterPasses.cpp3
-rw-r--r--polly/lib/Transform/Canonicalization.cpp7
-rw-r--r--polly/lib/Transform/CodePreparation.cpp35
9 files changed, 20 insertions, 141 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index a7801b087c5..d0b28564da8 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -577,12 +577,7 @@ bool ScopDetection::isValidInstruction(Instruction &Inst,
DetectionContext &Context) const {
if (PHINode *PN = dyn_cast<PHINode>(&Inst))
if (!canSynthesize(PN, LI, SE, &Context.CurRegion)) {
- if (SCEVCodegen)
- return invalid<ReportPhiNodeRefInRegion>(Context, /*Assert=*/true,
- &Inst);
- else
- return invalid<ReportNonCanonicalPhiNode>(Context, /*Assert=*/true,
- &Inst);
+ return invalid<ReportPhiNodeRefInRegion>(Context, /*Assert=*/true, &Inst);
}
// We only check the call instruction but not invoke instruction.
@@ -609,14 +604,6 @@ bool ScopDetection::isValidInstruction(Instruction &Inst,
}
bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const {
- if (!SCEVCodegen) {
- // If code generation is not in scev based mode, we need to ensure that
- // each loop has a canonical induction variable.
- PHINode *IndVar = L->getCanonicalInductionVariable();
- if (!IndVar)
- return invalid<ReportLoopHeader>(Context, /*Assert=*/true, L);
- }
-
// Is the loop count affine?
const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
if (!isAffineExpr(&Context.CurRegion, LoopCount, *SE))
diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
index 34e7ef7a622..6e869cf3e60 100644
--- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
+++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
@@ -351,43 +351,6 @@ bool ReportPhiNodeRefInRegion::classof(const RejectReason *RR) {
}
//===----------------------------------------------------------------------===//
-// ReportNonCanonicalPhiNode.
-
-ReportNonCanonicalPhiNode::ReportNonCanonicalPhiNode(Instruction *Inst)
- : ReportIndVar(rrkNonCanonicalPhiNode), Inst(Inst) {}
-
-std::string ReportNonCanonicalPhiNode::getMessage() const {
- return "Non canonical PHI node: " + *Inst;
-}
-
-const DebugLoc &ReportNonCanonicalPhiNode::getDebugLoc() const {
- return Inst->getDebugLoc();
-}
-
-bool ReportNonCanonicalPhiNode::classof(const RejectReason *RR) {
- return RR->getKind() == rrkNonCanonicalPhiNode;
-}
-
-//===----------------------------------------------------------------------===//
-// ReportLoopHeader.
-
-ReportLoopHeader::ReportLoopHeader(Loop *L)
- : ReportIndVar(rrkLoopHeader), L(L) {}
-
-std::string ReportLoopHeader::getMessage() const {
- return ("No canonical IV at loop header: " + L->getHeader()->getName()).str();
-}
-
-const DebugLoc &ReportLoopHeader::getDebugLoc() const {
- BasicBlock *BB = L->getHeader();
- return BB->getTerminator()->getDebugLoc();
-}
-
-bool ReportLoopHeader::classof(const RejectReason *RR) {
- return RR->getKind() == rrkLoopHeader;
-}
-
-//===----------------------------------------------------------------------===//
// ReportIndEdge.
ReportIndEdge::ReportIndEdge(BasicBlock *BB)
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 23a52814ab4..1b85804909f 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -17,7 +17,6 @@
//
//===----------------------------------------------------------------------===//
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/LinkAllPasses.h"
#include "polly/ScopInfo.h"
#include "polly/Options.h"
@@ -905,16 +904,10 @@ void ScopStmt::deriveAssumptions() {
ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion,
BasicBlock &bb, SmallVectorImpl<Loop *> &Nest,
SmallVectorImpl<unsigned> &Scatter)
- : Parent(parent), BB(&bb), IVS(Nest.size()), NestLoops(Nest.size()) {
+ : Parent(parent), BB(&bb), NestLoops(Nest.size()) {
// Setup the induction variables.
- for (unsigned i = 0, e = Nest.size(); i < e; ++i) {
- if (!SCEVCodegen) {
- PHINode *PN = Nest[i]->getCanonicalInductionVariable();
- assert(PN && "Non canonical IV in Scop!");
- IVS[i] = PN;
- }
+ for (unsigned i = 0, e = Nest.size(); i < e; ++i)
NestLoops[i] = Nest[i];
- }
BaseName = getIslCompatibleName("Stmt_", &bb, "");
@@ -1076,11 +1069,6 @@ unsigned ScopStmt::getNumScattering() const {
const char *ScopStmt::getBaseName() const { return BaseName.c_str(); }
-const PHINode *
-ScopStmt::getInductionVariableForDimension(unsigned Dimension) const {
- return IVS[Dimension];
-}
-
const Loop *ScopStmt::getLoopForDimension(unsigned Dimension) const {
return NestLoops[Dimension];
}
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index e483cae5347..4c0762ca69d 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -39,30 +39,17 @@ static cl::opt<bool> Aligned("enable-polly-aligned",
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
-static cl::opt<bool, true>
- SCEVCodegenF("polly-codegen-scev",
- cl::desc("Use SCEV based code generation."), cl::Hidden,
- cl::location(SCEVCodegen), cl::init(true), cl::ZeroOrMore,
- cl::cat(PollyCategory));
-
-bool polly::SCEVCodegen;
-
bool polly::canSynthesize(const Instruction *I, const llvm::LoopInfo *LI,
ScalarEvolution *SE, const Region *R) {
- if (SCEVCodegen) {
- if (!I || !SE->isSCEVable(I->getType()))
- return false;
-
- if (const SCEV *Scev = SE->getSCEV(const_cast<Instruction *>(I)))
- if (!isa<SCEVCouldNotCompute>(Scev))
- if (!hasScalarDepsInsideRegion(Scev, R))
- return true;
-
+ if (!I || !SE->isSCEVable(I->getType()))
return false;
- }
- Loop *L = LI->getLoopFor(I->getParent());
- return L && I == L->getCanonicalInductionVariable() && R->contains(L);
+ if (const SCEV *Scev = SE->getSCEV(const_cast<Instruction *>(I)))
+ if (!isa<SCEVCouldNotCompute>(Scev))
+ if (!hasScalarDepsInsideRegion(Scev, R))
+ return true;
+
+ return false;
}
BlockGenerator::BlockGenerator(PollyIRBuilder &B, ScopStmt &Stmt, Pass *P,
@@ -91,7 +78,7 @@ Value *BlockGenerator::getNewValue(const Value *Old, ValueMapT &BBMap,
if (Value *New = BBMap.lookup(Old))
return New;
- if (SCEVCodegen && SE.isSCEVable(Old->getType()))
+ if (SE.isSCEVable(Old->getType()))
if (const SCEV *Scev = SE.getSCEVAtScope(const_cast<Value *>(Old), L)) {
if (!isa<SCEVCouldNotCompute>(Scev)) {
const SCEV *NewScev = apply(Scev, LTS, SE);
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index d1b1709cafe..91da58c2fec 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -412,16 +412,6 @@ void ClastStmtCodeGen::codegen(const clast_assignment *A, ScopStmt *Stmt,
if (VLTS)
(*VLTS)[VectorDim][Stmt->getLoopForDimension(Dim)] = URHS;
LoopToScev[Stmt->getLoopForDimension(Dim)] = URHS;
-
- const PHINode *PN = Stmt->getInductionVariableForDimension(Dim);
- if (PN) {
- RHS = Builder.CreateTruncOrBitCast(RHS, PN->getType());
-
- if (VectorVMap)
- (*VectorVMap)[VectorDim][PN] = RHS;
-
- ValueMap[PN] = RHS;
- }
}
void ClastStmtCodeGen::codegenSubstitutions(const clast_stmt *Assignment,
diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp
index 5308da3c921..34043782e9b 100644
--- a/polly/lib/CodeGen/IslCodeGeneration.cpp
+++ b/polly/lib/CodeGen/IslCodeGeneration.cpp
@@ -751,15 +751,6 @@ void IslNodeBuilder::createSubstitutions(isl_ast_expr *Expr, ScopStmt *Stmt,
V = ExprBuilder.create(SubExpr);
ScalarEvolution *SE = Stmt->getParent()->getSE();
LTS[Stmt->getLoopForDimension(i)] = SE->getUnknown(V);
-
- // CreateIntCast can introduce trunc expressions. This is correct, as the
- // result will always fit into the type of the original induction variable
- // (because we calculate a value of the original induction variable).
- const Value *OldIV = Stmt->getInductionVariableForDimension(i);
- if (OldIV) {
- V = Builder.CreateIntCast(V, OldIV->getType(), true);
- VMap[OldIV] = V;
- }
}
// Add the current ValueMap to our per-statement value map.
diff --git a/polly/lib/Support/RegisterPasses.cpp b/polly/lib/Support/RegisterPasses.cpp
index 733920fce41..d40da37d04e 100644
--- a/polly/lib/Support/RegisterPasses.cpp
+++ b/polly/lib/Support/RegisterPasses.cpp
@@ -21,7 +21,6 @@
#include "polly/RegisterPasses.h"
#include "polly/Canonicalization.h"
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/CodeGen/Cloog.h"
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/Dependences.h"
@@ -195,7 +194,7 @@ void initializePollyPasses(PassRegistry &Registry) {
/// code generator. For the moment, the CLooG code generator is enabled by
/// default.
static void registerPollyPasses(llvm::PassManagerBase &PM) {
- registerCanonicalicationPasses(PM, SCEVCodegen);
+ registerCanonicalicationPasses(PM);
PM.add(polly::createScopInfoPass());
diff --git a/polly/lib/Transform/Canonicalization.cpp b/polly/lib/Transform/Canonicalization.cpp
index 0dc772850fb..40903c6b936 100644
--- a/polly/lib/Transform/Canonicalization.cpp
+++ b/polly/lib/Transform/Canonicalization.cpp
@@ -20,8 +20,7 @@
using namespace llvm;
using namespace polly;
-void polly::registerCanonicalicationPasses(llvm::PassManagerBase &PM,
- bool SCEVCodegen) {
+void polly::registerCanonicalicationPasses(llvm::PassManagerBase &PM) {
PM.add(llvm::createPromoteMemoryToRegisterPass());
PM.add(llvm::createInstructionCombiningPass());
PM.add(llvm::createCFGSimplificationPass());
@@ -30,10 +29,6 @@ void polly::registerCanonicalicationPasses(llvm::PassManagerBase &PM,
PM.add(llvm::createReassociatePass());
PM.add(llvm::createLoopRotatePass());
PM.add(llvm::createInstructionCombiningPass());
-
- if (!SCEVCodegen)
- PM.add(polly::createIndVarSimplifyPass());
-
PM.add(polly::createCodePreparationPass());
}
diff --git a/polly/lib/Transform/CodePreparation.cpp b/polly/lib/Transform/CodePreparation.cpp
index 4dc55563573..67e111bb0bd 100644
--- a/polly/lib/Transform/CodePreparation.cpp
+++ b/polly/lib/Transform/CodePreparation.cpp
@@ -9,20 +9,9 @@
//
// The Polly code preparation pass is executed before SCoP detection. Its only
// use is to translate all PHI nodes that can not be expressed by the code
-// generator into explicit memory dependences. Depending of the code generation
-// strategy different PHI nodes are translated:
+// generator into explicit memory dependences.
//
-// - indvars based code generation:
-//
-// The indvars based code generation requires explicit canonical induction
-// variables. Such variables are generated before scop detection and
-// also before the code preparation pass. All PHI nodes that are not canonical
-// induction variables are not supported by the indvars based code generation
-// and are consequently translated into explicit memory accesses.
-//
-// - scev based code generation:
-//
-// The scev based code generation can code generate all PHI nodes that do not
+// Polly's code generation can code generate all PHI nodes that do not
// reference parameters within the scop. As the code preparation pass is run
// before scop detection, we can not check this condition, because without
// a detected scop, we do not know SCEVUnknowns that appear in the SCEV of
@@ -128,21 +117,11 @@ bool CodePreparation::eliminatePHINodes(Function &F) {
for (BasicBlock::iterator II = BI->begin(), IE = BI->getFirstNonPHI();
II != IE; ++II) {
PHINode *PN = cast<PHINode>(II);
- if (SCEVCodegen) {
- if (SE->isSCEVable(PN->getType())) {
- const SCEV *S = SE->getSCEV(PN);
- if (!isa<SCEVUnknown>(S) && !isa<SCEVCouldNotCompute>(S)) {
- PNtoPreserve.push_back(PN);
- continue;
- }
- }
- } else {
- if (Loop *L = LI->getLoopFor(BI)) {
- // Induction variables will be preserved.
- if (L->getCanonicalInductionVariable() == PN) {
- PNtoPreserve.push_back(PN);
- continue;
- }
+ if (SE->isSCEVable(PN->getType())) {
+ const SCEV *S = SE->getSCEV(PN);
+ if (!isa<SCEVUnknown>(S) && !isa<SCEVCouldNotCompute>(S)) {
+ PNtoPreserve.push_back(PN);
+ continue;
}
}
OpenPOWER on IntegriCloud