Replace srem by function call in nonaffine test cases

This makes the test cases nonaffine even if Polly some days gains support for
the srem instruction, an instruction which is currently not modeled but which
can clearly be modeled statically. A call to a function without definition
will always remain non-affine, as there is just insufficient static information
for it to be modeled more precisely.

llvm-svn: 240458
This commit is contained in:
Tobias Grosser 2015-06-23 20:55:05 +00:00
parent 6ca162e6e0
commit a608569856
2 changed files with 13 additions and 6 deletions

View File

@ -2,7 +2,7 @@
;
; void f(int *A) {
; for (int i = 0; i < 1024; i++)
; S1: A[i % 2] = i;
; S1: A[bar(i)] = i;
; for (int i = 0; i < 1024; i++)
; S2: A[i2] = i;
; }
@ -18,6 +18,8 @@
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
declare i32 @bar(i32) #1
define void @f(i32* %A) {
entry:
br label %for.cond
@ -28,8 +30,8 @@ for.cond:
br i1 %exitcond, label %S1, label %next
S1:
%rem = srem i32 %i.0, 2
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %rem
%nonaff = call i32 @bar(i32 %i.0)
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %nonaff
store i32 %i.0, i32* %arrayidx, align 4
br label %for.inc
@ -58,3 +60,5 @@ for.end:
ret void
}
attributes #1 = { nounwind readnone }

View File

@ -4,11 +4,13 @@
;
; void f(int *A) {
; for (int i = 0; i < 1024; i++)
; A[i % 2] = i;
; A[bar(i)] = i;
; }
;
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
declare i32 @bar(i32) #1
define void @f(i32* %A) {
entry:
br label %for.cond
@ -19,8 +21,8 @@ for.cond: ; preds = %for.inc, %entry
br i1 %exitcond, label %for.body, label %for.end
for.body: ; preds = %for.cond
%rem = srem i32 %i.0, 2
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %rem
%nonaff = call i32 @bar(i32 %i.0)
%arrayidx = getelementptr inbounds i32, i32* %A, i32 %nonaff
store i32 %i.0, i32* %arrayidx, align 4
br label %for.inc
@ -32,3 +34,4 @@ for.end: ; preds = %for.cond
ret void
}
attributes #1 = { nounwind readnone }