llvm-project/clang/test/OpenMP/openmp-read-only-feature.c
Yaxun (Sam) Liu c8c5830715 Fix diag for read-only target features
Currently the diag is emitted even when there is no
target feature specified on command line for OpenMP.
This is because the function to initialize feature map
is also used with cached feature string. The fix is to
only diag when the feature map is initialized with
feature strings from command line options.

Reviewed by: Joseph Huber, Matt Arsenault, Johannes Doerfert

Differential Revision: https://reviews.llvm.org/D153123
2023-06-16 17:48:27 -04:00

17 lines
659 B
C

// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target
// REQUIRES: clang-target-64-bits
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx1030 \
// RUN: -fopenmp -nogpulib -fopenmp-is-device -verify %s
// expected-no-diagnostics
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx1030 \
// RUN: -fopenmp -nogpulib -target-feature -image-insts \
// RUN: -fopenmp-is-device -emit-llvm -S -o - %s 2>&1 | FileCheck %s
// CHECK: warning: feature flag '-image-insts' is ignored since the feature is read only
#pragma omp begin declare variant match(device = {arch(amdgcn)})
void foo();
#pragma omp end declare variant