[polly] r269048 - Simplify the internal representation according to the context [NFC]
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 05:18:22 PDT 2016
Author: jdoerfert
Date: Tue May 10 07:18:22 2016
New Revision: 269048
URL: http://llvm.org/viewvc/llvm-project?rev=269048&view=rev
Log:
Simplify the internal representation according to the context [NFC]
We now use context information to simplify the domains and access
functions of the SCoP instead of just aligning them with the parameter
space.
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll
polly/trunk/test/ScopInfo/integers.ll
polly/trunk/test/ScopInfo/modulo_zext_2.ll
polly/trunk/test/ScopInfo/non-precise-inv-load-5.ll
polly/trunk/test/ScopInfo/non_affine_region_1.ll
polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll
polly/trunk/test/ScopInfo/pointer-comparison-no-nsw.ll
polly/trunk/test/ScopInfo/pointer-comparison.ll
polly/trunk/test/ScopInfo/switch-1.ll
polly/trunk/test/ScopInfo/switch-2.ll
polly/trunk/test/ScopInfo/switch-4.ll
polly/trunk/test/ScopInfo/unsigned-division-3.ll
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue May 10 07:18:22 2016
@@ -892,10 +892,9 @@ MemoryAccess::MemoryAccess(ScopStmt *Stm
}
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, Assum
updateAccessDimensionality();
realignParams();
- addParameterBounds();
addUserContext();
// After the context was fully constructed, thus all our knowledge about
Modified: polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll Tue May 10 07:18:22 2016
@@ -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]
Modified: polly/trunk/test/ScopInfo/integers.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/integers.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/integers.ll (original)
+++ polly/trunk/test/ScopInfo/integers.ll Tue May 10 07:18:22 2016
@@ -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
Modified: polly/trunk/test/ScopInfo/modulo_zext_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/modulo_zext_2.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/modulo_zext_2.ll (original)
+++ polly/trunk/test/ScopInfo/modulo_zext_2.ll Tue May 10 07:18:22 2016
@@ -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]
Modified: polly/trunk/test/ScopInfo/non-precise-inv-load-5.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/non-precise-inv-load-5.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/non-precise-inv-load-5.ll (original)
+++ polly/trunk/test/ScopInfo/non-precise-inv-load-5.ll Tue May 10 07:18:22 2016
@@ -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:
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
Modified: polly/trunk/test/ScopInfo/non_affine_region_1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/non_affine_region_1.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/non_affine_region_1.ll (original)
+++ polly/trunk/test/ScopInfo/non_affine_region_1.ll Tue May 10 07:18:22 2016
@@ -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]
Modified: polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll (original)
+++ polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll Tue May 10 07:18:22 2016
@@ -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]
Modified: polly/trunk/test/ScopInfo/pointer-comparison-no-nsw.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/pointer-comparison-no-nsw.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/pointer-comparison-no-nsw.ll (original)
+++ polly/trunk/test/ScopInfo/pointer-comparison-no-nsw.ll Tue May 10 07:18:22 2016
@@ -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"
Modified: polly/trunk/test/ScopInfo/pointer-comparison.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/pointer-comparison.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/pointer-comparison.ll (original)
+++ polly/trunk/test/ScopInfo/pointer-comparison.ll Tue May 10 07:18:22 2016
@@ -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"
Modified: polly/trunk/test/ScopInfo/switch-1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/switch-1.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/switch-1.ll (original)
+++ polly/trunk/test/ScopInfo/switch-1.ll Tue May 10 07:18:22 2016
@@ -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]
Modified: polly/trunk/test/ScopInfo/switch-2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/switch-2.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/switch-2.ll (original)
+++ polly/trunk/test/ScopInfo/switch-2.ll Tue May 10 07:18:22 2016
@@ -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]
Modified: polly/trunk/test/ScopInfo/switch-4.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/switch-4.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/switch-4.ll (original)
+++ polly/trunk/test/ScopInfo/switch-4.ll Tue May 10 07:18:22 2016
@@ -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]
Modified: polly/trunk/test/ScopInfo/unsigned-division-3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/unsigned-division-3.ll?rev=269048&r1=269047&r2=269048&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/unsigned-division-3.ll (original)
+++ polly/trunk/test/ScopInfo/unsigned-division-3.ll Tue May 10 07:18:22 2016
@@ -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
More information about the llvm-commits
mailing list