summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-11-09 22:34:53 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-11-09 22:34:53 +0000
commitf317e3ac837012ffb2369ef622e830eb9c8a9823 (patch)
tree05d2db93bde3a26178309ff0928f001a3c8f8954
parent866b8ae928794243c611d10ccaf607a7d370b9d3 (diff)
downloadbcm5719-llvm-f317e3ac837012ffb2369ef622e830eb9c8a9823.tar.gz
bcm5719-llvm-f317e3ac837012ffb2369ef622e830eb9c8a9823.zip
Do not check memory accesses additionally with isValidAffineFunction
This check was necessary because of the use AffineSCEVIterator in TempScopInfo. As we removed this use recently it is not necessary any more. llvm-svn: 144228
-rwxr-xr-xpolly/include/polly/ScopDetection.h14
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp74
2 files changed, 0 insertions, 88 deletions
diff --git a/polly/include/polly/ScopDetection.h b/polly/include/polly/ScopDetection.h
index d21daf02054..f9480aa1263 100755
--- a/polly/include/polly/ScopDetection.h
+++ b/polly/include/polly/ScopDetection.h
@@ -187,20 +187,6 @@ class ScopDetection : public FunctionPass {
/// @return True if the BB contains only valid control flow.
bool isValidCFG(BasicBlock &BB, DetectionContext &Context) const;
- /// @brief Check if the SCEV expression is a valid affine function
- ///
- /// @param S The SCEV expression to be checked
- /// @param RefRegion The reference scope to check SCEV, it help to find out
- /// induction variables and parameters
- /// @param BasePtr If S represents a memory access, BasePtr should contain
- /// a valid memory location to which the base address of the
- /// memory access will be stored.
- ///
- /// @return True if the SCEV expression is affine, false otherwise
- ///
- bool isValidAffineFunction(const SCEV *S, Region &RefRegion,
- Value **BasePtr = 0) const;
-
/// @brief Is a loop valid with respect to a given region.
///
/// @param L The loop to check.
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 95087da81b8..8ea3e8f08ed 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -123,74 +123,6 @@ std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
return InvalidRegions.find(R)->second;
}
-
-bool ScopDetection::isValidAffineFunction(const SCEV *S, Region &RefRegion,
- Value **BasePtr) const {
- assert(S && "S must not be null!");
- bool isMemoryAccess = (BasePtr != 0);
- if (isMemoryAccess) *BasePtr = 0;
- DEBUG(dbgs() << "Checking " << *S << " ... ");
-
- if (isa<SCEVCouldNotCompute>(S)) {
- DEBUG(dbgs() << "Non Affine: SCEV could not be computed\n");
- return false;
- }
-
- for (AffineSCEVIterator I = affine_begin(S, SE), E = affine_end(); I != E;
- ++I) {
- // The constant part must be a SCEVConstant.
- // TODO: support sizeof in coefficient.
- if (!isa<SCEVConstant>(I->second)) {
- DEBUG(dbgs() << "Non Affine: Right hand side is not constant\n");
- return false;
- }
-
- const SCEV *Var = I->first;
-
- // A constant offset is affine.
- if(isa<SCEVConstant>(Var))
- continue;
-
- // Memory accesses are allowed to have a base pointer.
- if (Var->getType()->isPointerTy()) {
- if (!isMemoryAccess) {
- DEBUG(dbgs() << "Non Affine: Pointer in non memory access\n");
- return false;
- }
-
- assert(I->second->isOne() && "Only one as pointer coefficient allowed.\n");
- const SCEVUnknown *BaseAddr = dyn_cast<SCEVUnknown>(Var);
-
- if (!BaseAddr || isa<UndefValue>(BaseAddr->getValue())){
- DEBUG(dbgs() << "Cannot handle base: " << *Var << "\n");
- return false;
- }
-
- // BaseAddr must be invariant in Scop.
- if (!isParameter(BaseAddr, RefRegion, *LI, *SE)) {
- DEBUG(dbgs() << "Non Affine: Base address not invariant in SCoP\n");
- return false;
- }
-
- assert(*BasePtr == 0 && "Found second base pointer.\n");
- *BasePtr = BaseAddr->getValue();
- continue;
- }
-
- if (isParameter(Var, RefRegion, *LI, *SE)
- || isIndVar(Var, RefRegion, *LI, *SE))
- continue;
-
- DEBUG(dbgs() << "Non Affine: " ;
- Var->print(dbgs());
- dbgs() << " is neither parameter nor induction variable\n");
- return false;
- }
-
- DEBUG(dbgs() << " is affine.\n");
- return !isMemoryAccess || (*BasePtr != 0);
-}
-
bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const
{
Region &RefRegion = Context.CurRegion;
@@ -284,12 +216,6 @@ bool ScopDetection::isValidMemoryAccess(Instruction &Inst,
if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, &BasePtr))
INVALID(AffFunc, "Bad memory address " << *AccessFunction);
- // FIXME: Also check with isValidAffineFunction, as for the moment it is
- // protecting us to fail because of not supported features in TempScop.
- // As soon as TempScop is fixed, this needs to be removed.
- if (!isValidAffineFunction(AccessFunction, Context.CurRegion, &BasePtr))
- INVALID(AffFunc, "Access not supported in TempScop" << *AccessFunction);
-
// FIXME: Alias Analysis thinks IntToPtrInst aliases with alloca instructions
// created by IndependentBlocks Pass.
if (isa<IntToPtrInst>(BasePtr))
OpenPOWER on IntegriCloud