[llvm-commits] [polly] r152928 - in /polly/trunk: lib/Support/SCEVValidator.cpp test/CodeGen/20120316-InvalidCast.ll

Tobias Grosser grosser at fim.uni-passau.de
Fri Mar 16 09:36:48 PDT 2012


Author: grosser
Date: Fri Mar 16 11:36:47 2012
New Revision: 152928

URL: http://llvm.org/viewvc/llvm-project?rev=152928&view=rev
Log:
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 at gmail.com>

Added:
    polly/trunk/test/CodeGen/20120316-InvalidCast.ll
Modified:
    polly/trunk/lib/Support/SCEVValidator.cpp

Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=152928&r1=152927&r2=152928&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Fri Mar 16 11:36:47 2012
@@ -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);
 

Added: polly/trunk/test/CodeGen/20120316-InvalidCast.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CodeGen/20120316-InvalidCast.ll?rev=152928&view=auto
==============================================================================
--- polly/trunk/test/CodeGen/20120316-InvalidCast.ll (added)
+++ polly/trunk/test/CodeGen/20120316-InvalidCast.ll Fri Mar 16 11:36:47 2012
@@ -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
+}





More information about the llvm-commits mailing list