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
This commit is contained in:
Tobias Grosser 2012-03-16 16:36:47 +00:00
parent 8e5af375db
commit 3ec2abc5fb
2 changed files with 30 additions and 0 deletions

View File

@ -279,6 +279,16 @@ public:
ValidatorResult visitUnknown(const SCEVUnknown *Expr) { ValidatorResult visitUnknown(const SCEVUnknown *Expr) {
Value *V = Expr->getValue(); 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)) if (isa<UndefValue>(V))
return ValidatorResult(SCEVType::INVALID); return ValidatorResult(SCEVType::INVALID);

View File

@ -0,0 +1,20 @@
; RUN: opt %loadPolly %defaultOpts -polly-codegen %s
target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32f64:64:64-f32:32:32-a0:0-n32"
target triple = "hexagon-unknown-linux-gnu"
define void @fixup_gotos(i32* %A, i32* %data) nounwind {
entry:
br label %if
if:
%cond = icmp eq i32* %A, null
br i1 %cond, label %last, label %then
then:
store i32 1, i32* %data, align 4
br label %last
last:
ret void
}