[test] Add descriptions and pseudocode to tests. NFC.

llvm-svn: 310385
This commit is contained in:
Michael Kruse 2017-08-08 17:26:19 +00:00
parent f370f2e3c6
commit 235726ee4b
8 changed files with 94 additions and 1 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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