summaryrefslogtreecommitdiffstats
path: root/polly/test
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-08-08 17:26:19 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-08-08 17:26:19 +0000
commit235726ee4b868e665d64d41c1a24f9c061845d9c (patch)
treece345c467376845c99119dea70fe961aea0c0bdf /polly/test
parentf370f2e3c668c95969a10abcd66dec76b028cd1a (diff)
downloadbcm5719-llvm-235726ee4b868e665d64d41c1a24f9c061845d9c.tar.gz
bcm5719-llvm-235726ee4b868e665d64d41c1a24f9c061845d9c.zip
[test] Add descriptions and pseudocode to tests. NFC.
llvm-svn: 310385
Diffstat (limited to 'polly/test')
-rw-r--r--polly/test/ForwardOpTree/forward_hoisted.ll3
-rw-r--r--polly/test/ForwardOpTree/forward_load.ll8
-rw-r--r--polly/test/ForwardOpTree/forward_load_differentarray.ll15
-rw-r--r--polly/test/ForwardOpTree/forward_load_fromloop.ll14
-rw-r--r--polly/test/ForwardOpTree/forward_load_indirect.ll12
-rw-r--r--polly/test/ForwardOpTree/forward_load_tripleuse.ll17
-rw-r--r--polly/test/ForwardOpTree/noforward_load_conditional.ll15
-rw-r--r--polly/test/ForwardOpTree/noforward_load_writebetween.ll11
8 files changed, 94 insertions, 1 deletions
diff --git a/polly/test/ForwardOpTree/forward_hoisted.ll b/polly/test/ForwardOpTree/forward_hoisted.ll
index 7efaf2b5ec0..3241f07de6b 100644
--- a/polly/test/ForwardOpTree/forward_hoisted.ll
+++ b/polly/test/ForwardOpTree/forward_hoisted.ll
@@ -1,6 +1,7 @@
; RUN: opt %loadPolly -polly-invariant-load-hoisting=true -polly-optree -analyze < %s | FileCheck %s -match-full-lines
;
-; Move %val to %bodyB, so %bodyA can be removed (by -polly-simplify)
+; Move %val to %bodyB, so %bodyA can be removed (by -polly-simplify).
+; This involves making the load-hoisted %val1 to be made available in %bodyB.
;
; for (int j = 0; j < n; j += 1) {
; bodyA:
diff --git a/polly/test/ForwardOpTree/forward_load.ll b/polly/test/ForwardOpTree/forward_load.ll
index 176ea97e827..9281f199f60 100644
--- a/polly/test/ForwardOpTree/forward_load.ll
+++ b/polly/test/ForwardOpTree/forward_load.ll
@@ -2,6 +2,14 @@
;
; Rematerialize a load.
;
+; for (int j = 0; j < n; j += 1) {
+; bodyA:
+; double val = B[j];
+;
+; bodyB:
+; A[j] = val;
+; }
+;
define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
entry:
br label %for
diff --git a/polly/test/ForwardOpTree/forward_load_differentarray.ll b/polly/test/ForwardOpTree/forward_load_differentarray.ll
index 7580ddbd0c8..26342820044 100644
--- a/polly/test/ForwardOpTree/forward_load_differentarray.ll
+++ b/polly/test/ForwardOpTree/forward_load_differentarray.ll
@@ -1,5 +1,20 @@
; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
;
+; To forward %val, B[j] cannot be reused in bodyC because it is overwritten
+; between. Verify that instead the alternative C[j] is used.
+;
+; for (int j = 0; j < n; j += 1) {
+; bodyA:
+; double val = B[j];
+;
+; bodyB:
+; B[j] = 0;
+; C[j] = val;
+;
+; bodyC:
+; A[j] = val;
+; }
+;
define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B, double* noalias nonnull %C) {
entry:
br label %for
diff --git a/polly/test/ForwardOpTree/forward_load_fromloop.ll b/polly/test/ForwardOpTree/forward_load_fromloop.ll
index ef24924fd37..511df986949 100644
--- a/polly/test/ForwardOpTree/forward_load_fromloop.ll
+++ b/polly/test/ForwardOpTree/forward_load_fromloop.ll
@@ -1,5 +1,19 @@
; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
;
+; Forward a the LoadInst %val into %bodyB. %val is executed multiple times,
+; we must get the last loaded values.
+;
+; for (int j = 0; j < n; j += 1) {
+; double val;
+; for (int i = 0; i < n; i += 1) {
+; bodyA:
+; val = B[j];
+; }
+;
+; bodyB:
+; A[j] = val;
+; }
+;
define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
entry:
br label %for
diff --git a/polly/test/ForwardOpTree/forward_load_indirect.ll b/polly/test/ForwardOpTree/forward_load_indirect.ll
index 58ef66758d9..243ee2f7499 100644
--- a/polly/test/ForwardOpTree/forward_load_indirect.ll
+++ b/polly/test/ForwardOpTree/forward_load_indirect.ll
@@ -1,5 +1,17 @@
; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
;
+; Forward an operand tree consisting of a speculatable instruction (%add)
+; and a load (%val).
+;
+; for (int j = 0; j < n; j += 1) {
+; bodyA:
+; double val = B[j];
+; double add = val + 42.0;
+;
+; bodyB:
+; A[j] = add;
+; }
+;
define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
entry:
br label %for
diff --git a/polly/test/ForwardOpTree/forward_load_tripleuse.ll b/polly/test/ForwardOpTree/forward_load_tripleuse.ll
index 2d4f789b691..c1528281bfc 100644
--- a/polly/test/ForwardOpTree/forward_load_tripleuse.ll
+++ b/polly/test/ForwardOpTree/forward_load_tripleuse.ll
@@ -1,5 +1,22 @@
; RUN: opt %loadPolly -polly-optree -polly-codegen -analyze < %s | FileCheck %s -match-full-lines
;
+; %val1 is used three times: Twice by its own operand tree of %val2 and once
+; more by the store in %bodyB.
+; Verify that we can handle multiple uses by the same instruction and uses
+; in multiple statements as well.
+; The result processing may depend on the order in which the values are used,
+; hence we check both orderings.
+;
+; for (int j = 0; j < n; j += 1) {
+; bodyA:
+; double val1 = A[j];
+; double val2 = val1 + val1;
+;
+; bodyB:
+; B[j] = val1;
+; C[j] = val2;
+; }
+;
define void @func1(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B, double* noalias nonnull %C) {
entry:
br label %for
diff --git a/polly/test/ForwardOpTree/noforward_load_conditional.ll b/polly/test/ForwardOpTree/noforward_load_conditional.ll
index a4b31d1847c..95bec95ecd0 100644
--- a/polly/test/ForwardOpTree/noforward_load_conditional.ll
+++ b/polly/test/ForwardOpTree/noforward_load_conditional.ll
@@ -1,5 +1,20 @@
; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
;
+; B[j] is overwritten by at least one statement between the
+; definition of %val and its use. Hence, it cannot be forwarded.
+;
+; for (int j = 0; j < n; j += 1) {
+; bodyA:
+; double val = B[j];
+; if (j < 1) {
+; bodyA_true:
+; B[j] = 0.0;
+; }
+;
+; bodyB:
+; A[j] = val;
+; }
+;
define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
entry:
br label %for
diff --git a/polly/test/ForwardOpTree/noforward_load_writebetween.ll b/polly/test/ForwardOpTree/noforward_load_writebetween.ll
index f4fc701fd82..3c84d5f96b7 100644
--- a/polly/test/ForwardOpTree/noforward_load_writebetween.ll
+++ b/polly/test/ForwardOpTree/noforward_load_writebetween.ll
@@ -3,6 +3,17 @@
; Cannot rematerialize %val from B[0] at bodyC because B[0] has been
; overwritten in bodyB.
;
+; for (int j = 0; j < n; j += 1) {
+; bodyA:
+; double val = B[j];
+;
+; bodyB:
+; B[j] = 0.0;
+;
+; bodyC:
+; A[j] = val;
+; }
+;
define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
entry:
br label %for
OpenPOWER on IntegriCloud