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)
187 lines
5.5 KiB
C++
187 lines
5.5 KiB
C++
// Check no warnings/errors
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fsyntax-only -verify %s
|
|
// expected-no-diagnostics
|
|
|
|
// Check AST and unparsing
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -ast-dump %s | FileCheck %s --check-prefix=DUMP
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -ast-print %s | FileCheck %s --check-prefix=PRINT
|
|
|
|
// Check same results after serialization round-trip
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -include-pch %t -ast-print %s | FileCheck %s --check-prefix=PRINT
|
|
|
|
#ifndef HEADER
|
|
#define HEADER
|
|
|
|
// placeholder for loop body code.
|
|
extern "C" void body(...);
|
|
|
|
|
|
// PRINT-LABEL: void foo1(
|
|
// DUMP-LABEL: FunctionDecl {{.*}} foo1
|
|
void foo1() {
|
|
// PRINT: #pragma omp tile sizes(5, 5)
|
|
// DUMP: OMPTileDirective
|
|
// DUMP-NEXT: OMPSizesClause
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
#pragma omp tile sizes(5,5)
|
|
// PRINT: for (int i = 7; i < 17; i += 3)
|
|
// DUMP-NEXT: ForStmt
|
|
for (int i = 7; i < 17; i += 3)
|
|
// PRINT: for (int j = 7; j < 17; j += 3)
|
|
// DUMP: ForStmt
|
|
for (int j = 7; j < 17; j += 3)
|
|
// PRINT: body(i, j);
|
|
// DUMP: CallExpr
|
|
body(i, j);
|
|
}
|
|
|
|
|
|
// PRINT-LABEL: void foo2(
|
|
// DUMP-LABEL: FunctionDecl {{.*}} foo2
|
|
void foo2(int start1, int start2, int end1, int end2) {
|
|
// PRINT: #pragma omp tile sizes(5, 5)
|
|
// DUMP: OMPTileDirective
|
|
// DUMP-NEXT: OMPSizesClause
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
#pragma omp tile sizes(5,5)
|
|
// PRINT: for (int i = start1; i < end1; i += 1)
|
|
// DUMP-NEXT: ForStmt
|
|
for (int i = start1; i < end1; i += 1)
|
|
// PRINT: for (int j = start2; j < end2; j += 1)
|
|
// DUMP: ForStmt
|
|
for (int j = start2; j < end2; j += 1)
|
|
// PRINT: body(i, j);
|
|
// DUMP: CallExpr
|
|
body(i, j);
|
|
}
|
|
|
|
|
|
// PRINT-LABEL: void foo3(
|
|
// DUMP-LABEL: FunctionDecl {{.*}} foo3
|
|
void foo3() {
|
|
// PRINT: #pragma omp for
|
|
// DUMP: OMPForDirective
|
|
// DUMP-NEXT: CapturedStmt
|
|
// DUMP-NEXT: CapturedDecl
|
|
#pragma omp for
|
|
// PRINT: #pragma omp tile sizes(5)
|
|
// DUMP-NEXT: OMPTileDirective
|
|
// DUMP-NEXT: OMPSizesClause
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
#pragma omp tile sizes(5)
|
|
for (int i = 7; i < 17; i += 3)
|
|
// PRINT: body(i);
|
|
// DUMP: CallExpr
|
|
body(i);
|
|
}
|
|
|
|
|
|
// PRINT-LABEL: void foo4(
|
|
// DUMP-LABEL: FunctionDecl {{.*}} foo4
|
|
void foo4() {
|
|
// PRINT: #pragma omp for collapse(3)
|
|
// DUMP: OMPForDirective
|
|
// DUMP-NEXT: OMPCollapseClause
|
|
// DUMP-NEXT: ConstantExpr
|
|
// DUMP-NEXT: value: Int 3
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 3
|
|
// DUMP-NEXT: CapturedStmt
|
|
// DUMP-NEXT: CapturedDecl
|
|
#pragma omp for collapse(3)
|
|
// PRINT: #pragma omp tile sizes(5, 5)
|
|
// DUMP: OMPTileDirective
|
|
// DUMP-NEXT: OMPSizesClause
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
#pragma omp tile sizes(5, 5)
|
|
// PRINT: for (int i = 7; i < 17; i += 1)
|
|
// DUMP-NEXT: ForStmt
|
|
for (int i = 7; i < 17; i += 1)
|
|
// PRINT: for (int j = 7; j < 17; j += 1)
|
|
// DUMP: ForStmt
|
|
for (int j = 7; j < 17; j += 1)
|
|
// PRINT: body(i, j);
|
|
// DUMP: CallExpr
|
|
body(i, j);
|
|
}
|
|
|
|
|
|
// PRINT-LABEL: void foo5(
|
|
// DUMP-LABEL: FunctionDecl {{.*}} foo5
|
|
void foo5(int start, int end, int step) {
|
|
// PRINT: #pragma omp for collapse(2)
|
|
// DUMP: OMPForDirective
|
|
// DUMP-NEXT: OMPCollapseClause
|
|
// DUMP-NEXT: ConstantExpr
|
|
// DUMP-NEXT: value: Int 2
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 2
|
|
// DUMP-NEXT: CapturedStmt
|
|
// DUMP-NEXT: CapturedDecl
|
|
#pragma omp for collapse(2)
|
|
// PRINT: for (int i = 7; i < 17; i += 1)
|
|
// DUMP-NEXT: ForStmt
|
|
for (int i = 7; i < 17; i += 1)
|
|
// PRINT: #pragma omp tile sizes(5)
|
|
// DUMP: OMPTileDirective
|
|
// DUMP-NEXT: OMPSizesClause
|
|
// DUMP-NEXT: IntegerLiteral {{.*}} 5
|
|
#pragma omp tile sizes(5)
|
|
// PRINT: for (int j = 7; j < 17; j += 1)
|
|
// DUMP-NEXT: ForStmt
|
|
for (int j = 7; j < 17; j += 1)
|
|
// PRINT: body(i, j);
|
|
// DUMP: CallExpr
|
|
body(i, j);
|
|
}
|
|
|
|
|
|
// PRINT-LABEL: void foo6(
|
|
// DUMP-LABEL: FunctionTemplateDecl {{.*}} foo6
|
|
template<typename T, T Step, T Tile>
|
|
void foo6(T start, T end) {
|
|
// PRINT: #pragma omp tile sizes(Tile)
|
|
// DUMP: OMPTileDirective
|
|
// DUMP-NEXT: OMPSizesClause
|
|
// DUMP-NEXT: DeclRefExpr {{.*}} 'Tile' 'T'
|
|
#pragma omp tile sizes(Tile)
|
|
// PRINT-NEXT: for (T i = start; i < end; i += Step)
|
|
// DUMP-NEXT: ForStmt
|
|
for (T i = start; i < end; i += Step)
|
|
// PRINT-NEXT: body(i);
|
|
// DUMP: CallExpr
|
|
body(i);
|
|
}
|
|
|
|
// Also test instantiating the template.
|
|
void tfoo6() {
|
|
foo6<int,3,5>(0, 42);
|
|
}
|
|
|
|
|
|
// PRINT-LABEL: template <int Tile> void foo7(int start, int stop, int step) {
|
|
// DUMP-LABEL: FunctionTemplateDecl {{.*}} foo7
|
|
template <int Tile>
|
|
void foo7(int start, int stop, int step) {
|
|
// PRINT: #pragma omp tile sizes(Tile)
|
|
// DUMP: OMPTileDirective
|
|
// DUMP-NEXT: OMPSizesClause
|
|
// DUMP-NEXT: DeclRefExpr {{.*}} 'Tile' 'int'
|
|
#pragma omp tile sizes(Tile)
|
|
// PRINT-NEXT: for (int i = start; i < stop; i += step)
|
|
// DUMP-NEXT: ForStmt
|
|
for (int i = start; i < stop; i += step)
|
|
// PRINT-NEXT: body(i);
|
|
// DUMP: CallExpr
|
|
body(i);
|
|
}
|
|
void tfoo7() {
|
|
foo7<5>(0, 42, 2);
|
|
}
|
|
|
|
|
|
#endif
|