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
This commit is contained in:
Tobias Grosser 2011-11-09 22:34:53 +00:00
parent 866b8ae928
commit f317e3ac83
2 changed files with 0 additions and 88 deletions

View File

@ -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.

View File

@ -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))