[polly] r230640 - Use isl_ast_expr_call to create run-time checks

Tobias Grosser tobias at grosser.es
Thu Feb 26 07:21:10 PST 2015


Author: grosser
Date: Thu Feb 26 09:21:10 2015
New Revision: 230640

URL: http://llvm.org/viewvc/llvm-project?rev=230640&view=rev
Log:
Use isl_ast_expr_call to create run-time checks

isl recently introduced a new interface to create run-time checks from
constraint sets. Use this interface to simplify our run-time check generation.

Modified:
    polly/trunk/lib/CodeGen/IslAst.cpp
    polly/trunk/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll
    polly/trunk/test/Isl/Ast/alias_simple_1.ll
    polly/trunk/test/Isl/Ast/alias_simple_2.ll
    polly/trunk/test/Isl/Ast/alias_simple_3.ll
    polly/trunk/test/Isl/Ast/simple-run-time-condition.ll
    polly/trunk/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll
    polly/trunk/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll
    polly/trunk/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Thu Feb 26 09:21:10 2015
@@ -313,23 +313,7 @@ void IslAst::buildRunCondition(__isl_kee
   // optimized scop can be executed conditionally according to the result of the
   // run-time check.
 
-  isl_aff *Zero =
-      isl_aff_zero_on_domain(isl_local_space_from_space(S->getParamSpace()));
-  isl_aff *One =
-      isl_aff_zero_on_domain(isl_local_space_from_space(S->getParamSpace()));
-
-  One = isl_aff_add_constant_si(One, 1);
-
-  isl_pw_aff *PwZero = isl_pw_aff_from_aff(Zero);
-  isl_pw_aff *PwOne = isl_pw_aff_from_aff(One);
-
-  PwOne = isl_pw_aff_intersect_domain(PwOne, S->getAssumedContext());
-  PwZero = isl_pw_aff_intersect_domain(
-      PwZero, isl_set_complement(S->getAssumedContext()));
-
-  isl_pw_aff *Cond = isl_pw_aff_union_max(PwOne, PwZero);
-
-  RunCondition = isl_ast_build_expr_from_pw_aff(Build, Cond);
+  RunCondition = isl_ast_build_expr_from_set(Build, S->getAssumedContext());
 
   // Create the alias checks from the minimal/maximal accesses in each alias
   // group. This operation is by construction quadratic in the number of

Modified: polly/trunk/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll (original)
+++ polly/trunk/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll Thu Feb 26 09:21:10 2015
@@ -41,7 +41,7 @@ ret:
   ret void
 }
 
-; CHECK: if (n <= 1024 ? 1 : 0)
+; CHECK: if (n <= 1024)
 ; CHECK:   #pragma omp parallel for
 ; CHECK:   for (int c0 = 0; c0 < n; c0 += 1)
 ; CHECK:     #pragma simd

Modified: polly/trunk/test/Isl/Ast/alias_simple_1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/alias_simple_1.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/Ast/alias_simple_1.ll (original)
+++ polly/trunk/test/Isl/Ast/alias_simple_1.ll Thu Feb 26 09:21:10 2015
@@ -12,11 +12,11 @@
 ;        A[i] = B[i];
 ;    }
 ;
-; NOAA: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; BASI: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; TBAA: if (N <= 1024 ? 1 : 0)
-; SCEV: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; GLOB: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; NOAA: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; BASI: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; TBAA: if (N <= 1024)
+; SCEV: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; GLOB: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
 ;
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 

Modified: polly/trunk/test/Isl/Ast/alias_simple_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/alias_simple_2.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/Ast/alias_simple_2.ll (original)
+++ polly/trunk/test/Isl/Ast/alias_simple_2.ll Thu Feb 26 09:21:10 2015
@@ -12,11 +12,11 @@
 ;        A[i] = B[i];
 ;    }
 ;
-; NOAA: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; BASI: if (N <= 1024 ? 1 : 0)
-; TBAA: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; SCEV: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; GLOB: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; NOAA: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; BASI: if (N <= 1024)
+; TBAA: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; SCEV: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; GLOB: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
 ;
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 

Modified: polly/trunk/test/Isl/Ast/alias_simple_3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/alias_simple_3.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/Ast/alias_simple_3.ll (original)
+++ polly/trunk/test/Isl/Ast/alias_simple_3.ll Thu Feb 26 09:21:10 2015
@@ -12,11 +12,11 @@
 ;        A[i] = B[i];
 ;    }
 ;
-; NOAA: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; BASI: if (N <= 1024 ? 1 : 0)
-; TBAA: if (N <= 1024 ? 1 : 0)
-; SCEV: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
-; GLOB: if ((N <= 1024 ? 1 : 0) && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; NOAA: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; BASI: if (N <= 1024)
+; TBAA: if (N <= 1024)
+; SCEV: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
+; GLOB: if (N <= 1024 && (&MemRef_A[N] <= &MemRef_B[0] || &MemRef_B[N] <= &MemRef_A[0]))
 ;
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 

Modified: polly/trunk/test/Isl/Ast/simple-run-time-condition.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/simple-run-time-condition.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/Ast/simple-run-time-condition.ll (original)
+++ polly/trunk/test/Isl/Ast/simple-run-time-condition.ll Thu Feb 26 09:21:10 2015
@@ -22,7 +22,7 @@ target triple = "x86_64-unknown-linux-gn
 ; CHECK: ({{(q == 100 && o <= 0|o <= 0 && q == 100)}})
 ; CHECK: ||
 ; CHECK: ({{(q == 0 && o >= 1)|(o >= 1 && q == 0)}})
-; CHECK: ? 1 : 0)
+; CHECK: )
 
 ; CHECK:     if (o >= 1) {
 ; CHECK:       for (int c1 = 0; c1 < n; c1 += 1)

Modified: polly/trunk/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll (original)
+++ polly/trunk/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll Thu Feb 26 09:21:10 2015
@@ -12,10 +12,8 @@ target triple = "x86_64-unknown-linux-gn
 ;
 ; CHECK: entry:
 ; CHECK: %0 = icmp sge i64 %m, 150
-; CHECK: %1 = select i1 %0, i64 1, i64 0
-; CHECK: %2 = icmp ne i64 %1, 0
 ; CHECK: polly.split_new_and_old:
-; CHECK: br i1 %2, label %polly.start, label %for.i
+; CHECK: br i1 %0, label %polly.start, label %for.i
 
 define void @foo(i64 %n, i64 %m, double* %A) {
 entry:

Modified: polly/trunk/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll (original)
+++ polly/trunk/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll Thu Feb 26 09:21:10 2015
@@ -2,9 +2,11 @@
 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-codegen-isl -S -polly-delinearize < %s | FileCheck %s
 
 ; CHECK: %1 = zext i32 %n to i64
-; CHECK: %2 = icmp sge i64 %1, 1
-; CHECK: %3 = select i1 %2, i64 1, i64 0
-; CHECK: %4 = icmp ne i64 %3, 0
+; CHECK-NEST: %2 = icmp sge i64 %1, 1
+; CHECK-NEST: br label %polly.split_new_and_old
+; CHECK: polly.split_new_and_old:
+; CHECK-NEXT: br i1 %2, label %polly.start, label %for.body4
+
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

Modified: polly/trunk/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll?rev=230640&r1=230639&r2=230640&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll (original)
+++ polly/trunk/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll Thu Feb 26 09:21:10 2015
@@ -10,8 +10,6 @@
 ;
 ; CHECK: %[[T0:[._a-zA-Z0-9]]] = zext i32 %n to i64
 ; CHECK: %[[T1:[._a-zA-Z0-9]]] = icmp sge i64 %[[T0]], 1
-; CHECK: %[[T2:[._a-zA-Z0-9]]] = select i1 %[[T1]], i64 1, i64 0
-; CHECK: %[[T3:[._a-zA-Z0-9]]] = icmp ne i64 %[[T2]], 0
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"





More information about the llvm-commits mailing list