diff options
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 16 | ||||
-rw-r--r-- | polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/integers.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/modulo_zext_2.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/non-precise-inv-load-5.ll | 18 | ||||
-rw-r--r-- | polly/test/ScopInfo/non_affine_region_1.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/phi_scalar_simple_1.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/pointer-comparison-no-nsw.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/pointer-comparison.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/switch-1.ll | 6 | ||||
-rw-r--r-- | polly/test/ScopInfo/switch-2.ll | 2 | ||||
-rw-r--r-- | polly/test/ScopInfo/switch-4.ll | 6 | ||||
-rw-r--r-- | polly/test/ScopInfo/unsigned-division-3.ll | 6 |
13 files changed, 39 insertions, 29 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 3b033152..72f4e25 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -892,10 +892,9 @@ MemoryAccess::MemoryAccess(ScopStmt *Stmt, Instruction *AccessInst, } void MemoryAccess::realignParams() { - isl_space *ParamSpace = Statement->getParent()->getParamSpace(); - InvalidDomain = - isl_set_align_params(InvalidDomain, isl_space_copy(ParamSpace)); - AccessRelation = isl_map_align_params(AccessRelation, ParamSpace); + auto *Ctx = Statement->getParent()->getContext(); + InvalidDomain = isl_set_gist_params(InvalidDomain, isl_set_copy(Ctx)); + AccessRelation = isl_map_gist_params(AccessRelation, Ctx); } const std::string MemoryAccess::getReductionOperatorStr() const { @@ -1115,8 +1114,9 @@ void ScopStmt::realignParams() { for (MemoryAccess *MA : *this) MA->realignParams(); - InvalidDomain = isl_set_align_params(InvalidDomain, Parent.getParamSpace()); - Domain = isl_set_align_params(Domain, Parent.getParamSpace()); + auto *Ctx = Parent.getContext(); + InvalidDomain = isl_set_gist_params(InvalidDomain, isl_set_copy(Ctx)); + Domain = isl_set_gist_params(Domain, Ctx); } /// @brief Add @p BSet to the set @p User if @p BSet is bounded. @@ -2030,6 +2030,9 @@ void Scop::realignParams() { // Align the parameters of all data structures to the model. Context = isl_set_align_params(Context, Space); + // As all parameters are known add bounds to them. + addParameterBounds(); + for (ScopStmt &Stmt : *this) Stmt.realignParams(); } @@ -3101,7 +3104,6 @@ void Scop::init(AliasAnalysis &AA, AssumptionCache &AC, ScopDetection &SD, updateAccessDimensionality(); realignParams(); - addParameterBounds(); addUserContext(); // After the context was fully constructed, thus all our knowledge about diff --git a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll index 6cd0b40a..ba6ce19 100644 --- a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll +++ b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll @@ -56,7 +56,7 @@ ; INNERMOST-NEXT: [p_0, p_1, p_2] -> { Stmt_bb16[i0] -> MemRef_A[i0] }; ; INNERMOST-NEXT: Stmt_bb26 ; INNERMOST-NEXT: Domain := -; INNERMOST-NEXT: [p_0, p_1, p_2] -> { Stmt_bb26[] : p_0 >= 0 }; +; INNERMOST-NEXT: [p_0, p_1, p_2] -> { Stmt_bb26[] }; ; INNERMOST-NEXT: Schedule := ; INNERMOST-NEXT: [p_0, p_1, p_2] -> { Stmt_bb26[] -> [1, 0] }; ; INNERMOST-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] diff --git a/polly/test/ScopInfo/integers.ll b/polly/test/ScopInfo/integers.ll index 55f02c8..70391ba 100644 --- a/polly/test/ScopInfo/integers.ll +++ b/polly/test/ScopInfo/integers.ll @@ -112,7 +112,7 @@ bb: %indvar.next = add nsw i3 %indvar, 1 %sub = sub i3 %n, 3 ; CHECK: 'bb => return' in function 'f6' -; CHECK: -3 +; CHECK: [n] -> { Stmt_bb[0] : n = 3 }; %exitcond = icmp eq i3 %indvar, %sub br i1 %exitcond, label %return, label %bb diff --git a/polly/test/ScopInfo/modulo_zext_2.ll b/polly/test/ScopInfo/modulo_zext_2.ll index 642046f..9d345a1 100644 --- a/polly/test/ScopInfo/modulo_zext_2.ll +++ b/polly/test/ScopInfo/modulo_zext_2.ll @@ -8,7 +8,7 @@ ; CHECK: Statements { ; CHECK-NEXT: Stmt_if_then ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_if_then[i0] : 2*floor((-1 + i0)/2) = -1 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_if_then[i0] : 2*floor((-1 + i0)/2) = -1 + i0 and 0 < i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_if_then[i0] -> [i0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/non-precise-inv-load-5.ll b/polly/test/ScopInfo/non-precise-inv-load-5.ll index 5c5f75a..70148d4 100644 --- a/polly/test/ScopInfo/non-precise-inv-load-5.ll +++ b/polly/test/ScopInfo/non-precise-inv-load-5.ll @@ -10,11 +10,18 @@ ; CHECK-NEXT: Execution Context: [c] -> { : 1 = 0 } ; CHECK-NEXT: } ; +; TODO: FIXME: We should remove the statement as it has an empty domain. +; CHECK: Stmt_if_then +; CHECK-NEXT: Domain := +; CHECK-NEXT: [c] -> { Stmt_if_then[i0] : 1 = 0 }; +; ; int I[1024]; ; void f(int *A, unsigned char c) { ; for (int i = 0; i < 10; i++) ; if ((signed char)(c + (unsigned char)1) == 127) ; A[i] += I[c]; +; else +; A[i] = 0; ; } ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -33,21 +40,22 @@ for.cond: ; preds = %for.inc, %entry for.body: ; preds = %for.cond %add = add i8 %c, 1 %cmp3 = icmp eq i8 %add, 128 - br i1 %cmp3, label %if.then, label %if.end + %arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv + br i1 %cmp3, label %if.then, label %if.else if.then: ; preds = %for.body %arrayidx = getelementptr inbounds [1024 x i32], [1024 x i32]* @I, i64 0, i8 %c %tmp = load i32, i32* %arrayidx, align 4 - %arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv %tmp1 = load i32, i32* %arrayidx6, align 4 %add7 = add nsw i32 %tmp1, %tmp store i32 %add7, i32* %arrayidx6, align 4 - br label %if.end + br label %for.inc -if.end: ; preds = %if.then, %for.body +if.else: ; preds = %if.then, %for.body + store i32 0, i32* %arrayidx6, align 4 br label %for.inc -for.inc: ; preds = %if.end +for.inc: ; preds = %if.else, if.then %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 br label %for.cond diff --git a/polly/test/ScopInfo/non_affine_region_1.ll b/polly/test/ScopInfo/non_affine_region_1.ll index a6e8954..aafdb68 100644 --- a/polly/test/ScopInfo/non_affine_region_1.ll +++ b/polly/test/ScopInfo/non_affine_region_1.ll @@ -35,7 +35,7 @@ ; CHECK-NEXT: [b] -> { Stmt_bb7[i0] -> MemRef_x_1__phi[] }; ; CHECK-NEXT: Stmt_bb8 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [b] -> { Stmt_bb8[i0] : i0 >= b and 0 <= i0 <= 1023 and 2i0 <= b }; +; CHECK-NEXT: [b] -> { Stmt_bb8[0] : b = 0 }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [b] -> { Stmt_bb8[i0] -> [0, 0] }; ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] diff --git a/polly/test/ScopInfo/phi_scalar_simple_1.ll b/polly/test/ScopInfo/phi_scalar_simple_1.ll index 9ef9b37..0b7ec16 100644 --- a/polly/test/ScopInfo/phi_scalar_simple_1.ll +++ b/polly/test/ScopInfo/phi_scalar_simple_1.ll @@ -26,7 +26,7 @@ ; CHECK-NEXT: [N] -> { Stmt_for_cond[i0] -> MemRef_x_addr_0[] }; ; CHECK-NEXT: Stmt_for_body ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_for_body[i0] : N >= 2 and 0 <= i0 <= -2 + N }; +; CHECK-NEXT: [N] -> { Stmt_for_body[i0] : 0 <= i0 <= -2 + N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> [i0, 1, 0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] diff --git a/polly/test/ScopInfo/pointer-comparison-no-nsw.ll b/polly/test/ScopInfo/pointer-comparison-no-nsw.ll index 473eb60..4b644af 100644 --- a/polly/test/ScopInfo/pointer-comparison-no-nsw.ll +++ b/polly/test/ScopInfo/pointer-comparison-no-nsw.ll @@ -11,7 +11,7 @@ ; CHECK-NEXT: [A, B] -> { : (4*floor((A - B)/4) < A - B) or (4*floor((-A + B)/4) = -A + B and B >= 9223372036854775808 + A) or (4*floor((-A + B)/4) = -A + B and B <= -4 + A) } ; ; CHECK: Domain := -; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : 4*floor((A - B)/4) = A - B and B >= A and i0 >= 0 and 4i0 < -A + B } +; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : 4*floor((-A + B)/4) = -A + B and i0 >= 0 and 4i0 <= -4 - A + B } ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/pointer-comparison.ll b/polly/test/ScopInfo/pointer-comparison.ll index 14b41509..d7ce6d2 100644 --- a/polly/test/ScopInfo/pointer-comparison.ll +++ b/polly/test/ScopInfo/pointer-comparison.ll @@ -13,7 +13,7 @@ ; CHECK-NEXT: [A, B] -> { : (4*floor((A - B)/4) < A - B) or (4*floor((-A + B)/4) = -A + B and B >= 9223372036854775808 + A) or (4*floor((-A + B)/4) = -A + B and B <= -4 + A) } ; ; CHECK: Domain := -; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : 4*floor((A - B)/4) = A - B and B >= A and i0 >= 0 and 4i0 < -A + B } +; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : 4*floor((-A + B)/4) = -A + B and i0 >= 0 and 4i0 <= -4 - A + B } ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/switch-1.ll b/polly/test/ScopInfo/switch-1.ll index 354f735..9b1aeab 100644 --- a/polly/test/ScopInfo/switch-1.ll +++ b/polly/test/ScopInfo/switch-1.ll @@ -21,7 +21,7 @@ ; CHECK: Statements { ; CHECK-NEXT: Stmt_sw_bb_1 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : 4*floor((-1 + i0)/4) = -1 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : 4*floor((-1 + i0)/4) = -1 + i0 and 0 < i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> [i0, 2] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -30,7 +30,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_2 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : 4*floor((-2 + i0)/4) = -2 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : 4*floor((-2 + i0)/4) = -2 + i0 and 2 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> [i0, 1] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -39,7 +39,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_6 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] : 4*floor((-3 + i0)/4) = -3 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] : 4*floor((-3 + i0)/4) = -3 + i0 and 3 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] -> [i0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/switch-2.ll b/polly/test/ScopInfo/switch-2.ll index 48c1b01..6e31f39 100644 --- a/polly/test/ScopInfo/switch-2.ll +++ b/polly/test/ScopInfo/switch-2.ll @@ -29,7 +29,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_2 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : 4*floor((-2 + i0)/4) = -2 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : 4*floor((-2 + i0)/4) = -2 + i0 and 2 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> [i0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/switch-4.ll b/polly/test/ScopInfo/switch-4.ll index 1323ccc..d76e0f8 100644 --- a/polly/test/ScopInfo/switch-4.ll +++ b/polly/test/ScopInfo/switch-4.ll @@ -33,7 +33,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_1 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : 4*floor((-1 + i0)/4) = -1 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : 4*floor((-1 + i0)/4) = -1 + i0 and 0 < i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> [i0, 2] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -42,7 +42,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_5 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] : 4*floor((-2 + i0)/4) = -2 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] : 4*floor((-2 + i0)/4) = -2 + i0 and 2 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> [i0, 1] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -51,7 +51,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_9 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] : 4*floor((-3 + i0)/4) = -3 + i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] : 4*floor((-3 + i0)/4) = -3 + i0 and 3 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] -> [i0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/unsigned-division-3.ll b/polly/test/ScopInfo/unsigned-division-3.ll index f0d732e..6f7e44f 100644 --- a/polly/test/ScopInfo/unsigned-division-3.ll +++ b/polly/test/ScopInfo/unsigned-division-3.ll @@ -1,7 +1,7 @@ ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; ; void f(int *A, unsigned char N) { -; for (unsigned i = 0; i < N / -128; i++) +; for (unsigned i = 0; i <= N / -128; i++) ; A[i]++; ; } ; @@ -11,7 +11,7 @@ ; CHECK-NEXT: [N] -> { : N < 0 } ; ; CHECK: Domain := -; CHECK-NEXT: [N] -> { Stmt_for_body[i0] : i0 >= 0 and 128i0 <= -128 + N }; +; CHECK-NEXT: [N] -> { Stmt_for_body[0] : N >= 0 }; ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -23,7 +23,7 @@ entry: for.cond: ; preds = %for.inc, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ] %lftr.wideiv = trunc i64 %indvars.iv to i8 - %exitcond = icmp ne i8 %lftr.wideiv, %tmp + %exitcond = icmp sle i8 %lftr.wideiv, %tmp br i1 %exitcond, label %for.body, label %for.end for.body: ; preds = %for.cond |