[polly] r312452 - [IslAst] Move buildCondition to isl++

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 3 11:31:44 PDT 2017


Author: grosser
Date: Sun Sep  3 11:31:44 2017
New Revision: 312452

URL: http://llvm.org/viewvc/llvm-project?rev=312452&view=rev
Log:
[IslAst] Move buildCondition to isl++

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

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=312452&r1=312451&r2=312452&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Sun Sep  3 11:31:44 2017
@@ -347,35 +347,33 @@ static __isl_give isl_ast_node *AtEachDo
 }
 
 // Build alias check condition given a pair of minimal/maximal access.
-static __isl_give isl_ast_expr *
-buildCondition(__isl_keep isl_ast_build *Build, const Scop::MinMaxAccessTy *It0,
-               const Scop::MinMaxAccessTy *It1) {
-  isl::id Left =
-      isl::manage(isl_pw_multi_aff_get_tuple_id(It0->first, isl_dim_set));
-  isl::id Right =
-      isl::manage(isl_pw_multi_aff_get_tuple_id(It1->first, isl_dim_set));
+static isl::ast_expr buildCondition(isl::ast_build Build,
+                                    const Scop::MinMaxAccessTy *It0,
+                                    const Scop::MinMaxAccessTy *It1) {
+
+  isl::pw_multi_aff AFirst = isl::manage(isl_pw_multi_aff_copy(It0->first));
+  isl::pw_multi_aff ASecond = isl::manage(isl_pw_multi_aff_copy(It0->second));
+  isl::pw_multi_aff BFirst = isl::manage(isl_pw_multi_aff_copy(It1->first));
+  isl::pw_multi_aff BSecond = isl::manage(isl_pw_multi_aff_copy(It1->second));
+
+  isl::id Left = AFirst.get_tuple_id(isl::dim::set);
+  isl::id Right = BFirst.get_tuple_id(isl::dim::set);
 
   const ScopArrayInfo *BaseLeft =
       ScopArrayInfo::getFromId(Left)->getBasePtrOriginSAI();
   const ScopArrayInfo *BaseRight =
       ScopArrayInfo::getFromId(Right)->getBasePtrOriginSAI();
-  if (BaseLeft && BaseLeft == BaseRight) {
-    return isl_ast_expr_from_val(
-        isl_val_int_from_si(isl_ast_build_get_ctx(Build), 1));
-  }
+  if (BaseLeft && BaseLeft == BaseRight)
+    return isl::ast_expr::from_val(isl::val::int_from_ui(Build.get_ctx(), 1));
 
-  isl_ast_expr *NonAliasGroup, *MinExpr, *MaxExpr;
-  MinExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
-      Build, isl_pw_multi_aff_copy(It0->first)));
-  MaxExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
-      Build, isl_pw_multi_aff_copy(It1->second)));
-  NonAliasGroup = isl_ast_expr_le(MaxExpr, MinExpr);
-  MinExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
-      Build, isl_pw_multi_aff_copy(It1->first)));
-  MaxExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
-      Build, isl_pw_multi_aff_copy(It0->second)));
-  NonAliasGroup =
-      isl_ast_expr_or(NonAliasGroup, isl_ast_expr_le(MaxExpr, MinExpr));
+  isl::ast_expr NonAliasGroup, MinExpr, MaxExpr;
+  MinExpr = Build.access_from(AFirst).address_of();
+  MaxExpr = Build.access_from(BSecond).address_of();
+  NonAliasGroup = MaxExpr.le(MinExpr);
+  MinExpr = Build.access_from(BFirst).address_of();
+  MaxExpr = Build.access_from(ASecond).address_of();
+  NonAliasGroup = isl::manage(
+      isl_ast_expr_or(NonAliasGroup.release(), MaxExpr.le(MinExpr).release()));
 
   return NonAliasGroup;
 }
@@ -412,10 +410,14 @@ IslAst::buildRunCondition(Scop &S, __isl
          ++RWAccIt0) {
       for (auto RWAccIt1 = RWAccIt0 + 1; RWAccIt1 != RWAccEnd; ++RWAccIt1)
         RunCondition = isl_ast_expr_and(
-            RunCondition, buildCondition(Build, RWAccIt0, RWAccIt1));
+            RunCondition, buildCondition(isl::manage(isl_ast_build_copy(Build)),
+                                         RWAccIt0, RWAccIt1)
+                              .release());
       for (const Scop::MinMaxAccessTy &ROAccIt : MinMaxReadOnly)
         RunCondition = isl_ast_expr_and(
-            RunCondition, buildCondition(Build, RWAccIt0, &ROAccIt));
+            RunCondition, buildCondition(isl::manage(isl_ast_build_copy(Build)),
+                                         RWAccIt0, &ROAccIt)
+                              .release());
     }
   }
 




More information about the llvm-commits mailing list