[llvm-branch-commits] [polly] r229086 - Revert "Add support for pointer types in expressions"

Tobias Grosser tobias at grosser.es
Fri Feb 13 00:31:07 PST 2015


Author: grosser
Date: Fri Feb 13 02:31:06 2015
New Revision: 229086

URL: http://llvm.org/viewvc/llvm-project?rev=229086&view=rev
Log:
Revert "Add support for pointer types in expressions"

This reverts commit 6f02dfa802f92ee81f95ef55bf1e376a741a59fd (r225464).

This commit has a couple of problems which we do not want to have in the
3.6 release.

Reported-by: Geoff Nixon

Removed:
    polly/branches/release_36/test/Isl/CodeGen/pointer-type-expressions.ll
    polly/branches/release_36/test/ScopInfo/pointer-type-expressions.ll
Modified:
    polly/branches/release_36/lib/Analysis/ScopInfo.cpp
    polly/branches/release_36/lib/CodeGen/IslCodeGeneration.cpp
    polly/branches/release_36/lib/CodeGen/IslExprBuilder.cpp
    polly/branches/release_36/lib/Support/SCEVValidator.cpp

Modified: polly/branches/release_36/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_36/lib/Analysis/ScopInfo.cpp?rev=229086&r1=229085&r2=229086&view=diff
==============================================================================
--- polly/branches/release_36/lib/Analysis/ScopInfo.cpp (original)
+++ polly/branches/release_36/lib/Analysis/ScopInfo.cpp Fri Feb 13 02:31:06 2015
@@ -1171,18 +1171,14 @@ void Scop::addParameterBounds() {
     isl_id *Id;
     const SCEV *Scev;
     const IntegerType *T;
-    int Width;
 
     Id = isl_set_get_dim_id(Context, isl_dim_param, i);
     Scev = (const SCEV *)isl_id_get_user(Id);
-    isl_id_free(Id);
-
     T = dyn_cast<IntegerType>(Scev->getType());
+    isl_id_free(Id);
 
-    if (!T)
-      continue;
-
-    Width = T->getBitWidth();
+    assert(T && "Not an integer type");
+    int Width = T->getBitWidth();
 
     V = isl_val_int_from_si(IslCtx, Width - 1);
     V = isl_val_2exp(V);

Modified: polly/branches/release_36/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_36/lib/CodeGen/IslCodeGeneration.cpp?rev=229086&r1=229085&r2=229086&view=diff
==============================================================================
--- polly/branches/release_36/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/branches/release_36/lib/CodeGen/IslCodeGeneration.cpp Fri Feb 13 02:31:06 2015
@@ -872,7 +872,8 @@ void IslNodeBuilder::addParameters(__isl
 
 Value *IslNodeBuilder::generateSCEV(const SCEV *Expr) {
   Instruction *InsertLocation = --(Builder.GetInsertBlock()->end());
-  return Rewriter->expandCodeFor(Expr, Expr->getType(), InsertLocation);
+  return Rewriter->expandCodeFor(Expr, cast<IntegerType>(Expr->getType()),
+                                 InsertLocation);
 }
 
 namespace {

Modified: polly/branches/release_36/lib/CodeGen/IslExprBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_36/lib/CodeGen/IslExprBuilder.cpp?rev=229086&r1=229085&r2=229086&view=diff
==============================================================================
--- polly/branches/release_36/lib/CodeGen/IslExprBuilder.cpp (original)
+++ polly/branches/release_36/lib/CodeGen/IslExprBuilder.cpp Fri Feb 13 02:31:06 2015
@@ -287,16 +287,13 @@ Value *IslExprBuilder::createOpICmp(__is
   LHS = create(isl_ast_expr_get_op_arg(Expr, 0));
   RHS = create(isl_ast_expr_get_op_arg(Expr, 1));
 
-  bool IsPtrType =
-      LHS->getType()->isPointerTy() || RHS->getType()->isPointerTy();
+  bool IsPtrType = LHS->getType()->isPointerTy();
+  assert((!IsPtrType || RHS->getType()->isPointerTy()) &&
+         "Both ICmp operators should be pointer types or none of them");
 
   if (LHS->getType() != RHS->getType()) {
     if (IsPtrType) {
       Type *I8PtrTy = Builder.getInt8PtrTy();
-      if (!LHS->getType()->isPointerTy())
-        LHS = Builder.CreateIntToPtr(LHS, I8PtrTy);
-      if (!RHS->getType()->isPointerTy())
-        RHS = Builder.CreateIntToPtr(RHS, I8PtrTy);
       if (LHS->getType() != I8PtrTy)
         LHS = Builder.CreateBitCast(LHS, I8PtrTy);
       if (RHS->getType() != I8PtrTy)

Modified: polly/branches/release_36/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_36/lib/Support/SCEVValidator.cpp?rev=229086&r1=229085&r2=229086&view=diff
==============================================================================
--- polly/branches/release_36/lib/Support/SCEVValidator.cpp (original)
+++ polly/branches/release_36/lib/Support/SCEVValidator.cpp Fri Feb 13 02:31:06 2015
@@ -336,8 +336,8 @@ public:
     //     A[i] = 1;
     //
     // See test/CodeGen/20120316-InvalidCast.ll
-    if (!(Expr->getType()->isIntegerTy() || Expr->getType()->isPointerTy())) {
-      DEBUG(dbgs() << "INVALID: UnknownExpr is not an integer or pointer type");
+    if (!Expr->getType()->isIntegerTy()) {
+      DEBUG(dbgs() << "INVALID: UnknownExpr is not an integer type");
       return ValidatorResult(SCEVType::INVALID);
     }
 

Removed: polly/branches/release_36/test/Isl/CodeGen/pointer-type-expressions.ll
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_36/test/Isl/CodeGen/pointer-type-expressions.ll?rev=229085&view=auto
==============================================================================
--- polly/branches/release_36/test/Isl/CodeGen/pointer-type-expressions.ll (original)
+++ polly/branches/release_36/test/Isl/CodeGen/pointer-type-expressions.ll (removed)
@@ -1,47 +0,0 @@
-; RUN: opt %loadPolly -polly-ast -analyze < %s | FileCheck %s
-; RUN: opt %loadPolly -polly-codegen-isl -S < %s | FileCheck %s -check-prefix=CODEGEN
-
-; void f(int a[], int N, float *P) {
-;   int i;
-;   for (i = 0; i < N; ++i)
-;     if (*P != 0)
-;       a[i] = i;
-; }
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @f(i64* nocapture %a, i64 %N, float * %P) nounwind {
-entry:
-  br label %bb
-
-bb:
-  %i = phi i64 [ 0, %entry ], [ %i.inc, %bb.backedge ]
-  %brcond = icmp ne float* %P, null
-  br i1 %brcond, label %store, label %bb.backedge
-
-store:
-  %scevgep = getelementptr i64* %a, i64 %i
-  store i64 %i, i64* %scevgep
-  br label %bb.backedge
-
-bb.backedge:
-  %i.inc = add nsw i64 %i, 1
-  %exitcond = icmp eq i64 %i.inc, %N
-  br i1 %exitcond, label %return, label %bb
-
-return:
-  ret void
-}
-
-; CHECK: if (P <= -1) {
-; CHECK:   for (int c0 = 0; c0 < N; c0 += 1)
-; CHECK:     Stmt_store(c0);
-; CHECK: } else if (P >= 1)
-; CHECK:   for (int c0 = 0; c0 < N; c0 += 1)
-; CHECK:     Stmt_store(c0);
-; CHECK: }
-
-; CODEGEN:   %0 = bitcast float* %P to i8*
-; CODEGEN:   %1 = icmp ule i8* %0, inttoptr (i64 -1 to i8*)
-

Removed: polly/branches/release_36/test/ScopInfo/pointer-type-expressions.ll
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_36/test/ScopInfo/pointer-type-expressions.ll?rev=229085&view=auto
==============================================================================
--- polly/branches/release_36/test/ScopInfo/pointer-type-expressions.ll (original)
+++ polly/branches/release_36/test/ScopInfo/pointer-type-expressions.ll (removed)
@@ -1,49 +0,0 @@
-; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
-
-; void f(int a[], int N, float *P) {
-;   int i;
-;   for (i = 0; i < N; ++i)
-;     if (*P != 0)
-;       a[i] = i;
-; }
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @f(i64* nocapture %a, i64 %N, float * %P) nounwind {
-entry:
-  br label %bb
-
-bb:
-  %i = phi i64 [ 0, %entry ], [ %i.inc, %bb.backedge ]
-  %brcond = icmp ne float* %P, null
-  br i1 %brcond, label %store, label %bb.backedge
-
-store:
-  %scevgep = getelementptr i64* %a, i64 %i
-  store i64 %i, i64* %scevgep
-  br label %bb.backedge
-
-bb.backedge:
-  %i.inc = add nsw i64 %i, 1
-  %exitcond = icmp eq i64 %i.inc, %N
-  br i1 %exitcond, label %return, label %bb
-
-return:
-  ret void
-}
-
-; CHECK: Assumed Context:
-; CHECK:   {  :  }
-
-; CHECK:  Stmt_store
-; CHECK:        Domain :=
-; CHECK:            [N, P] -> { Stmt_store[i0] :
-; CHECK:              (P <= -1 and i0 >= 0 and i0 <= -1 + N)
-; CHECK:                or
-; CHECK:              (P >= 1 and i0 >= 0 and i0 <= -1 + N)
-; CHECK:                   };
-; CHECK:        Scattering :=
-; CHECK:            [N, P] -> { Stmt_store[i0] -> scattering[i0] };
-; CHECK:        MustWriteAccess := [Reduction Type: NONE]
-; CHECK:            [N, P] -> { Stmt_store[i0] -> MemRef_a[i0] };





More information about the llvm-branch-commits mailing list