From f72bdbfbb11f6562d44d6039b92eb69d133c7776 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 26 Feb 2015 15:21:10 +0000 Subject: [PATCH] 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. llvm-svn: 230640 --- polly/lib/CodeGen/IslAst.cpp | 18 +----------------- .../Ast/OpenMP/nested_loop_both_parallel_parametric.ll | 2 +- polly/test/Isl/Ast/alias_simple_1.ll | 10 +++++----- polly/test/Isl/Ast/alias_simple_2.ll | 10 +++++----- polly/test/Isl/Ast/alias_simple_3.ll | 10 +++++----- polly/test/Isl/Ast/simple-run-time-condition.ll | 2 +- .../multidim_2d_parametric_array_static_loop_bounds.ll | 4 +--- .../CodeGen/run-time-condition-with-scev-parameters.ll | 8 +++++--- .../scop_never_executed_runtime_check_location.ll | 2 -- 9 files changed, 24 insertions(+), 42 deletions(-) diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp index 5b26d3f..cfc8628 100644 --- a/polly/lib/CodeGen/IslAst.cpp +++ b/polly/lib/CodeGen/IslAst.cpp @@ -313,23 +313,7 @@ void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) { // 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 diff --git a/polly/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll b/polly/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll index 5e86ddb..832521c 100644 --- a/polly/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll +++ b/polly/test/Isl/Ast/OpenMP/nested_loop_both_parallel_parametric.ll @@ -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 diff --git a/polly/test/Isl/Ast/alias_simple_1.ll b/polly/test/Isl/Ast/alias_simple_1.ll index dd05c55..9224b0a 100644 --- a/polly/test/Isl/Ast/alias_simple_1.ll +++ b/polly/test/Isl/Ast/alias_simple_1.ll @@ -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" diff --git a/polly/test/Isl/Ast/alias_simple_2.ll b/polly/test/Isl/Ast/alias_simple_2.ll index 7a6a556..ca32c82 100644 --- a/polly/test/Isl/Ast/alias_simple_2.ll +++ b/polly/test/Isl/Ast/alias_simple_2.ll @@ -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" diff --git a/polly/test/Isl/Ast/alias_simple_3.ll b/polly/test/Isl/Ast/alias_simple_3.ll index be75ab2..493671d 100644 --- a/polly/test/Isl/Ast/alias_simple_3.ll +++ b/polly/test/Isl/Ast/alias_simple_3.ll @@ -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" diff --git a/polly/test/Isl/Ast/simple-run-time-condition.ll b/polly/test/Isl/Ast/simple-run-time-condition.ll index e99f64d..a2257f8 100644 --- a/polly/test/Isl/Ast/simple-run-time-condition.ll +++ b/polly/test/Isl/Ast/simple-run-time-condition.ll @@ -22,7 +22,7 @@ target triple = "x86_64-unknown-linux-gnu" ; 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) diff --git a/polly/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll b/polly/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll index c482381..e547058 100644 --- a/polly/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll +++ b/polly/test/Isl/CodeGen/multidim_2d_parametric_array_static_loop_bounds.ll @@ -12,10 +12,8 @@ target triple = "x86_64-unknown-linux-gnu" ; ; 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: diff --git a/polly/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll b/polly/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll index c3629b7..d819003 100644 --- a/polly/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll +++ b/polly/test/Isl/CodeGen/run-time-condition-with-scev-parameters.ll @@ -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" diff --git a/polly/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll b/polly/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll index e698096..d0f460b 100644 --- a/polly/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll +++ b/polly/test/Isl/CodeGen/scop_never_executed_runtime_check_location.ll @@ -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" -- 2.7.4