Reuse the old BaseAddress checking in SCEVValidator to make sure that no base
address is part of the access function. Also remove unused special cases that
were necessery when the base address was still contained in the access function
llvm-svn: 144280
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp
index fe70510..8daeb1f 100644
--- a/polly/lib/Support/SCEVValidator.cpp
+++ b/polly/lib/Support/SCEVValidator.cpp
@@ -57,11 +57,11 @@
private:
const Region *R;
ScalarEvolution &SE;
- Value **BaseAddress;
+ const Value *BaseAddress;
public:
SCEVValidator(const Region *R, ScalarEvolution &SE,
- Value **BaseAddress) : R(R), SE(SE),
+ const Value *BaseAddress) : R(R), SE(SE),
BaseAddress(BaseAddress) {};
struct ValidatorResult visitConstant(const SCEVConstant *Constant) {
@@ -215,33 +215,23 @@
if (isa<UndefValue>(V))
return ValidatorResult(SCEVType::INVALID);
- if (BaseAddress) {
- if (*BaseAddress)
- return ValidatorResult(SCEVType::INVALID);
- else
- *BaseAddress = V;
- }
-
if (Instruction *I = dyn_cast<Instruction>(Expr->getValue()))
if (R->contains(I))
return ValidatorResult(SCEVType::INVALID);
- if (BaseAddress)
- return ValidatorResult(SCEVType::PARAM);
- else
- return ValidatorResult(SCEVType::PARAM, Expr);
+ if (BaseAddress == V)
+ return ValidatorResult(SCEVType::INVALID);
+
+ return ValidatorResult(SCEVType::PARAM, Expr);
}
};
namespace polly {
bool isAffineExpr(const Region *R, const SCEV *Expr, ScalarEvolution &SE,
- Value **BaseAddress) {
+ const Value *BaseAddress) {
if (isa<SCEVCouldNotCompute>(Expr))
return false;
- if (BaseAddress)
- *BaseAddress = NULL;
-
SCEVValidator Validator(R, SE, BaseAddress);
ValidatorResult Result = Validator.visit(Expr);
@@ -251,13 +241,10 @@
std::vector<const SCEV*> getParamsInAffineExpr(const Region *R,
const SCEV *Expr,
ScalarEvolution &SE,
- Value **BaseAddress) {
+ const Value *BaseAddress) {
if (isa<SCEVCouldNotCompute>(Expr))
return std::vector<const SCEV*>();
- if (BaseAddress)
- *BaseAddress = NULL;
-
SCEVValidator Validator(R, SE, BaseAddress);
ValidatorResult Result = Validator.visit(Expr);