
Allow non-constants in the `sizes` clause such as ``` #pragma omp tile sizes(a) for (int i = 0; i < n; ++i) ``` This is permitted since tile was introduced in [OpenMP 5.1](https://www.openmp.org/spec-html/5.1/openmpsu53.html#x78-860002.11.9). It is possible to sneak-in negative numbers at runtime as in ``` int a = -1; #pragma omp tile sizes(a) ``` Even though it is not well-formed, it should still result in every loop iteration to be executed exactly once, an invariant of the tile construct that we should ensure. `ParseOpenMPExprListClause` is extracted-out to be reused by the `permutation` clause of the `interchange` construct. Some care was put into ensuring correct behavior in template contexts.
45 lines
933 B
C
45 lines
933 B
C
// RUN: %libomp-compile-and-run | FileCheck %s --match-full-lines
|
|
|
|
#ifndef HEADER
|
|
#define HEADER
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
int tilesize = -2;
|
|
|
|
int main() {
|
|
printf("do\n");
|
|
#pragma omp tile sizes(tilesize, tilesize)
|
|
for (int i = 7; i < 19; i += 3)
|
|
for (int j = 7; j < 20; j += 3)
|
|
printf("i=%d j=%d\n", i, j);
|
|
printf("done\n");
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
#endif /* HEADER */
|
|
|
|
// CHECK: do
|
|
// CHECK-NEXT: i=7 j=7
|
|
// CHECK-NEXT: i=7 j=10
|
|
// CHECK-NEXT: i=7 j=13
|
|
// CHECK-NEXT: i=7 j=16
|
|
// CHECK-NEXT: i=7 j=19
|
|
// CHECK-NEXT: i=10 j=7
|
|
// CHECK-NEXT: i=10 j=10
|
|
// CHECK-NEXT: i=10 j=13
|
|
// CHECK-NEXT: i=10 j=16
|
|
// CHECK-NEXT: i=10 j=19
|
|
// CHECK-NEXT: i=13 j=7
|
|
// CHECK-NEXT: i=13 j=10
|
|
// CHECK-NEXT: i=13 j=13
|
|
// CHECK-NEXT: i=13 j=16
|
|
// CHECK-NEXT: i=13 j=19
|
|
// CHECK-NEXT: i=16 j=7
|
|
// CHECK-NEXT: i=16 j=10
|
|
// CHECK-NEXT: i=16 j=13
|
|
// CHECK-NEXT: i=16 j=16
|
|
// CHECK-NEXT: i=16 j=19
|
|
// CHECK-NEXT: done
|