Don't allow pointer types in affine expressions
We currently do not support pointer types in affine expressions. Hence, we
disallow in the SCoP detection. Later we may decide to add support for them.
This fixes PR12277
Reported-By: Sebastian Pop <sebpop@gmail.com>
llvm-svn: 152928
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp
index eb26424..a70cf1a 100644
--- a/polly/lib/Support/SCEVValidator.cpp
+++ b/polly/lib/Support/SCEVValidator.cpp
@@ -279,6 +279,16 @@
ValidatorResult visitUnknown(const SCEVUnknown *Expr) {
Value *V = Expr->getValue();
+ // We currently only support integer types. It may be useful to support
+ // pointer types, e.g. to support code like:
+ //
+ // if (A)
+ // A[i] = 1;
+ //
+ // See test/CodeGen/20120316-InvalidCast.ll
+ if (!Expr->getType()->isIntegerTy())
+ return ValidatorResult(SCEVType::INVALID);
+
if (isa<UndefValue>(V))
return ValidatorResult(SCEVType::INVALID);