
This is a minimal patch to support parsing for "omp assume" directives. These are meant to be hints to a compiler's optimisers: as such, it is legitimate (if not very useful) to ignore them. The patch builds on top of the existing support for "omp assumes" directives (note spelling!). Unlike the "omp [begin/end] assumes" directives, "omp assume" is associated with a compound statement, i.e. it can appear within a function. The "holds" assumption could (theoretically) be mapped onto the existing builtin "__builtin_assume", though the latter applies to a single point in the program, and the former to a range (i.e. the whole of the associated compound statement). This patch fixes sollve's OpenMP 5.1 "omp assume"-based tests.
54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -ast-print %s | FileCheck %s
|
|
// expected-no-diagnostics
|
|
|
|
extern void bar();
|
|
|
|
void foo()
|
|
{
|
|
#pragma omp assume no_openmp_routines
|
|
// CHECK: omp assume no_openmp_routines
|
|
{
|
|
#pragma omp assume no_parallelism
|
|
// CHECK: omp assume no_parallelism
|
|
{}
|
|
}
|
|
|
|
#pragma omp target
|
|
// CHECK: omp target
|
|
{
|
|
#pragma omp assume holds(1==1)
|
|
// CHECK: omp assume holds(1 == 1)
|
|
{}
|
|
}
|
|
|
|
#pragma omp assume no_parallelism
|
|
// CHECK: omp assume no_parallelism
|
|
{
|
|
#pragma omp target
|
|
// CHECK: omp target
|
|
{}
|
|
}
|
|
|
|
#pragma omp assume absent(parallel)
|
|
// CHECK: omp assume absent(parallel)
|
|
{
|
|
#pragma omp assume contains(target, loop)
|
|
// CHECK: omp assume contains(target, loop)
|
|
{
|
|
#pragma omp assume holds(1==1)
|
|
// CHECK: omp assume holds(1 == 1)
|
|
{
|
|
#pragma omp assume absent(teams)
|
|
// CHECK: omp assume absent(teams)
|
|
{
|
|
#pragma omp assume no_openmp_routines
|
|
// CHECK: omp assume no_openmp_routines
|
|
{
|
|
bar();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|