mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-04 14:26:09 +00:00

Since these assumptions are coming from OpenMP it makes sense to mark them as such in the generic IR encoding. Standardized assumptions will be named omp_ASSUMPTION_NAME and extensions will be named ompx_ASSUMPTION_NAME which is the OpenMP 5.2 syntax for "extensions" of any kind. This also matches what the OpenMP-Opt pass expects. Summarized, #pragma omp [...] assume[s] no_parallelism now generates the same IR assumption annotation as __attribute__((assume("omp_no_parallelism"))) Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D105937
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
|
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
|
// expected-no-diagnostics
|
|
|
|
#ifndef HEADER
|
|
#define HEADER
|
|
|
|
void foo() {
|
|
}
|
|
|
|
#pragma omp assumes no_openmp_routines
|
|
|
|
namespace inner {
|
|
#pragma omp assumes no_openmp
|
|
} // namespace inner
|
|
|
|
#pragma omp begin assumes ext_range_bar_only
|
|
|
|
#pragma omp begin assumes ext_range_bar_only_2
|
|
|
|
void bar() {
|
|
}
|
|
|
|
#pragma omp end assumes
|
|
#pragma omp end assumes
|
|
|
|
#pragma omp begin assumes ext_not_seen
|
|
#pragma omp end assumes
|
|
|
|
#pragma omp begin assumes ext_1234
|
|
void baz() {
|
|
}
|
|
#pragma omp end assumes
|
|
|
|
// CHECK: void foo() __attribute__((assume("omp_no_openmp_routines"))) __attribute__((assume("omp_no_openmp")))
|
|
// CHECK: void bar() __attribute__((assume("ompx_range_bar_only"))) __attribute__((assume("ompx_range_bar_only_2"))) __attribute__((assume("omp_no_openmp_routines"))) __attribute__((assume("omp_no_openmp")))
|
|
// CHECK: void baz() __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines"))) __attribute__((assume("omp_no_openmp")))
|
|
|
|
#endif
|