[polly] r308870 - Convert GPUNodeBuilder::getArraySize to islcpp.

Siddharth Bhat via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 02:08:21 PDT 2017


Author: bollu
Date: Mon Jul 24 02:08:21 2017
New Revision: 308870

URL: http://llvm.org/viewvc/llvm-project?rev=308870&view=rev
Log:
Convert GPUNodeBuilder::getArraySize to islcpp.

Note: PPCGCodeGeneration::pollyBuildAstExprForStmt is at
      https://reviews.llvm.org/D35770

Differential Revision: https://reviews.llvm.org/D35771

Modified:
    polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp

Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=308870&r1=308869&r2=308870&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Mon Jul 24 02:08:21 2017
@@ -1015,25 +1015,28 @@ static bool isPrefix(std::string String,
 }
 
 Value *GPUNodeBuilder::getArraySize(gpu_array_info *Array) {
-  isl_ast_build *Build = isl_ast_build_from_context(S.getContext());
+  isl::ast_build Build =
+      isl::ast_build::from_context(isl::manage(S.getContext()));
   Value *ArraySize = ConstantInt::get(Builder.getInt64Ty(), Array->size);
 
   if (!gpu_array_is_scalar(Array)) {
-    auto OffsetDimZero = isl_multi_pw_aff_get_pw_aff(Array->bound, 0);
-    isl_ast_expr *Res = isl_ast_build_expr_from_pw_aff(Build, OffsetDimZero);
+    isl::multi_pw_aff ArrayBound =
+        isl::manage(isl_multi_pw_aff_copy(Array->bound));
+
+    isl::pw_aff OffsetDimZero = ArrayBound.get_pw_aff(0);
+    isl::ast_expr Res = Build.expr_from(OffsetDimZero);
 
     for (unsigned int i = 1; i < Array->n_index; i++) {
-      isl_pw_aff *Bound_I = isl_multi_pw_aff_get_pw_aff(Array->bound, i);
-      isl_ast_expr *Expr = isl_ast_build_expr_from_pw_aff(Build, Bound_I);
-      Res = isl_ast_expr_mul(Res, Expr);
+      isl::pw_aff Bound_I = ArrayBound.get_pw_aff(i);
+      isl::ast_expr Expr = Build.expr_from(Bound_I);
+      Res = Res.mul(Expr);
     }
 
-    Value *NumElements = ExprBuilder.create(Res);
+    Value *NumElements = ExprBuilder.create(Res.release());
     if (NumElements->getType() != ArraySize->getType())
       NumElements = Builder.CreateSExt(NumElements, ArraySize->getType());
     ArraySize = Builder.CreateMul(ArraySize, NumElements);
   }
-  isl_ast_build_free(Build);
   return ArraySize;
 }
 




More information about the llvm-commits mailing list