The default version of OpenMP is updated from 5.0 to 5.1 which means if -fopenmp is specified but -fopenmp-version is not specified with clang, the default version of OpenMP is taken to be 5.1. After modifying the Frontend for that, various LIT tests were updated. This patch contains all such changes. At a high level, these are the patterns of changes observed in LIT tests - # RUN lines which mentioned `-fopenmp-version=50` need to kept only if the IR for version 5.0 and 5.1 are different. Otherwise only one RUN line with no version info(i.e. default version) needs to be there. # Test cases of this sort already had the RUN lines with respect to the older default version 5.0 and the version 5.1. Only swapping the version specification flag `-fopenmp-version` from newer version RUN line to older version RUN line is required. # Diagnostics: Remove the 5.0 version specific RUN lines if there was no difference in the Diagnostics messages with respect to the default 5.1. # Diagnostics: In case there was any difference in diagnostics messages between 5.0 and 5.1, mention version specific messages in tests. # If the test contained version specific ifdef's e.g. "#ifdef OMP5" but there were no RUN lines for any other version than 5.X, then bring the code guarded by ifdef's outside and remove the ifdef's. # Some tests had RUN lines for both 5.0 and 5.1 versions, but it is found that the IR for 5.0 is not different from the 5.1, therefore such RUN lines are redundant. So, such duplicated lines are removed. # To generate CHECK lines automatically, use the script llvm/utils/update_cc_test_checks.py Reviewed By: saiislam, ABataev Differential Revision: https://reviews.llvm.org/D129635 (cherry picked from commit 9dd2999907dc791136a75238a6000f69bf67cf4e)
131 lines
5.1 KiB
C++
131 lines
5.1 KiB
C++
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++17 -fopenmp -fsyntax-only -Wuninitialized -verify %s
|
|
|
|
void func(int n) {
|
|
// expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
|
|
#pragma omp unroll
|
|
func(n);
|
|
|
|
// expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
|
|
#pragma omp unroll
|
|
;
|
|
|
|
// expected-error@+2 {{the loop condition expression depends on the current loop control variable}}
|
|
#pragma omp unroll
|
|
for (int i = 0; i < 2*(i-4); ++i) {}
|
|
|
|
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
|
|
#pragma omp unroll
|
|
for (int i = 0; i/3 < 7; ++i) {}
|
|
|
|
// expected-warning@+1 {{extra tokens at the end of '#pragma omp unroll' are ignored}}
|
|
#pragma omp unroll foo
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
|
#pragma omp unroll partial(
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
|
#pragma omp unroll partial(4
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
|
#pragma omp unroll partial(4+
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
|
#pragma omp unroll partial(for)
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'void (int)'}}
|
|
#pragma omp unroll partial(func)
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{expected expression}}
|
|
#pragma omp unroll partial()
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
|
#pragma omp unroll partial(4,4)
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+3 {{expression is not an integral constant expression}} expected-note@+3 {{read of non-const variable 'a' is not allowed in a constant expression}}
|
|
// expected-note@+1 {{declared here}}
|
|
int a;
|
|
#pragma omp unroll partial(a)
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{argument to 'partial' clause must be a strictly positive integer value}}
|
|
#pragma omp unroll partial(0)
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'partial' clause}}
|
|
#pragma omp unroll partial partial
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'partial' clause}}
|
|
#pragma omp unroll partial(4) partial
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'full' clause}}
|
|
#pragma omp unroll full full
|
|
for (int i = 0; i < 128; ++i) {}
|
|
|
|
// expected-error@+1 {{'full' and 'partial' clause are mutually exclusive and may not appear on the same directive}} expected-note@+1 {{'partial' clause is specified here}}
|
|
#pragma omp unroll partial full
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+1 {{'partial' and 'full' clause are mutually exclusive and may not appear on the same directive}} expected-note@+1 {{'full' clause is specified here}}
|
|
#pragma omp unroll full partial
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+2 {{loop to be fully unrolled must have a constant trip count}} expected-note@+1 {{'#pragma omp unroll full' directive found here}}
|
|
#pragma omp unroll full
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+2 {{statement after '#pragma omp for' must be a for loop}}
|
|
#pragma omp for
|
|
#pragma omp unroll
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+2 {{statement after '#pragma omp for' must be a for loop}}
|
|
#pragma omp for
|
|
#pragma omp unroll full
|
|
for (int i = 0; i < 128; ++i) {}
|
|
|
|
// expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
|
|
#pragma omp unroll
|
|
#pragma omp unroll
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+2 {{statement after '#pragma omp tile' must be a for loop}}
|
|
#pragma omp tile sizes(4)
|
|
#pragma omp unroll
|
|
for (int i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+4 {{expected 2 for loops after '#pragma omp for', but found only 1}}
|
|
// expected-note@+1 {{as specified in 'collapse' clause}}
|
|
#pragma omp for collapse(2)
|
|
for (int i = 0; i < n; ++i) {
|
|
#pragma omp unroll full
|
|
for (int j = 0; j < 128; ++j) {}
|
|
}
|
|
}
|
|
|
|
|
|
template<typename T, int Factor>
|
|
void templated_func(int n) {
|
|
// expected-error@+1 {{argument to 'partial' clause must be a strictly positive integer value}}
|
|
#pragma omp unroll partial(Factor)
|
|
for (T i = 0; i < n; ++i) {}
|
|
|
|
// expected-error@+2 {{loop to be fully unrolled must have a constant trip count}} expected-note@+1 {{'#pragma omp unroll full' directive found here}}
|
|
#pragma omp unroll full
|
|
for (int i = 0; i < n; i-=Factor) {}
|
|
}
|
|
|
|
void template_inst(int n) {
|
|
// expected-note@+1 {{in instantiation of function template specialization 'templated_func<int, -1>' requested here}}
|
|
templated_func<int, -1>(n);
|
|
}
|