[clang] 3b2f19d - [OpenMP][NFC] Pre-commit test changes regarding PR48933

Johannes Doerfert via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 15 11:16:52 PST 2021


Author: Johannes Doerfert
Date: 2021-02-15T13:16:44-06:00
New Revision: 3b2f19d0bc2803697526191a8a607efa0b38f7e4

URL: https://github.com/llvm/llvm-project/commit/3b2f19d0bc2803697526191a8a607efa0b38f7e4
DIFF: https://github.com/llvm/llvm-project/commit/3b2f19d0bc2803697526191a8a607efa0b38f7e4.diff

LOG: [OpenMP][NFC] Pre-commit test changes regarding PR48933

This will highlight the effective changes in subsequent commits.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D95903

Added: 
    

Modified: 
    clang/test/OpenMP/nvptx_unsupported_type_messages.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp
index 814a4756c01b..0601728caefe 100644
--- a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp
+++ b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp
@@ -77,11 +77,135 @@ T1 bar1() {
 void baz1() {
   T1 t = bar1();
 }
+
+// TODO: We should not emit an error for dead functions we do not emit.
+inline void dead_inline_declare_target() {
+// expected-note at +1 {{'b' defined here}}
+  long double *a, b = 0;
+// expected-error at +1 {{'b' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  a = &b;
+}
+// TODO: We should not emit an error for dead functions we do not emit.
+static void dead_static_declare_target() {
+// expected-note at +1 {{'b' defined here}}
+  long double *a, b = 0;
+// expected-error at +1 {{'b' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  a = &b;
+}
+template<bool>
+void dead_template_declare_target() {
+  long double *a, b = 0;
+  a = &b;
+}
+
+// TODO: We should diagnose the return type and argument type here.
+long double ld_return1a() { return 0; }
+void ld_arg1a(long double ld) {}
+
+// TODO: We should diagnose the return type and argument type here.
+typedef long double ld_ty;
+ld_ty ld_return1b() { return 0; }
+void ld_arg1b(ld_ty ld) {}
+
+static long double ld_return1c() { return 0; }
+static void ld_arg1c(long double ld) {}
+
+inline long double ld_return1d() { return 0; }
+inline void ld_arg1d(long double ld) {}
+
+// expected-note at +1 {{'ld_return1e' defined here}}
+static long double ld_return1e() { return 0; }
+// expected-note at +1 {{'ld_arg1e' defined here}}
+static void ld_arg1e(long double ld) {}
+
+// expected-note at +1 {{'ld_return1f' defined here}}
+inline long double ld_return1f() { return 0; }
+// expected-note at +1 {{'ld_arg1f' defined here}}
+inline void ld_arg1f(long double ld) {}
+
+inline void ld_use1() {
+// expected-note at +1 {{'ld' defined here}}
+  long double ld = 0;
+// TODO: We should not diagnose this as the function is dead.
+// expected-error at +1 {{'ld' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  ld += 1;
+}
+static void ld_use2() {
+// expected-note at +1 {{'ld' defined here}}
+  long double ld = 0;
+// TODO: We should not diagnose this as the function is dead.
+// expected-error at +1 {{'ld' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  ld += 1;
+}
+
+inline void ld_use3() {
+// expected-note at +1 {{'ld' defined here}}
+  long double ld = 0;
+// expected-error at +1 {{'ld' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  ld += 1;
+}
+static void ld_use4() {
+// expected-note at +1 {{'ld' defined here}}
+  long double ld = 0;
+// expected-error at +1 {{'ld' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  ld += 1;
+}
+
+void external() {
+// expected-error at +1 {{'ld_return1e' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  void *p1 = reinterpret_cast<void*>(&ld_return1e);
+// expected-error at +1 {{'ld_arg1e' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  void *p2 = reinterpret_cast<void*>(&ld_arg1e);
+// expected-error at +1 {{'ld_return1f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  void *p3 = reinterpret_cast<void*>(&ld_return1f);
+// expected-error at +1 {{'ld_arg1f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  void *p4 = reinterpret_cast<void*>(&ld_arg1f);
+  void *p5 = reinterpret_cast<void*>(&ld_use3);
+  void *p6 = reinterpret_cast<void*>(&ld_use4);
+}
+
+#ifndef _ARCH_PPC
+// TODO: We should diagnose the return type and argument type here.
+__float128 ld_return2a() { return 0; }
+void ld_arg2a(__float128 ld) {}
+
+// TODO: We should diagnose the return type and argument type here.
+typedef __float128 fp128_ty;
+fp128_ty ld_return2b() { return 0; }
+void ld_arg2b(fp128_ty ld) {}
+#endif
+
 #pragma omp end declare target
 
+// TODO: There should not be an error here, dead_inline is never emitted.
+// expected-note at +1 3{{'f' defined here}}
+inline long double dead_inline(long double f) {
+#pragma omp target map(f)
+// TODO: We should not emit the same error message 3 times, here and elsewhere in this file.
+  // expected-error at +1 3{{'f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  f = 1;
+  return f;
+}
+
+// TODO: There should not be an error here, dead_static is never emitted.
+// expected-note at +1 3{{'f' defined here}}
+static long double dead_static(long double f) {
+#pragma omp target map(f)
+  // expected-error at +1 3{{'f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
+  f = 1;
+  return f;
+}
+
+template<typename T>
+long double dead_template(long double f) {
+#pragma omp target map(f)
+  f = 1;
+  return f;
+}
+
 #ifndef _ARCH_PPC
 // expected-note at +1 3{{'f' defined here}}
-__float128 foo1(__float128 f) {
+__float128 foo2(__float128 f) {
 #pragma omp target map(f)
   // expected-error at +1 3{{'f' requires 128 bit size '__float128' type support, but device 'nvptx64-unknown-unknown' does not support it}}
   f = 1;
@@ -89,7 +213,7 @@ __float128 foo1(__float128 f) {
 }
 #else
 // expected-note at +1 3{{'f' defined here}}
-long double foo1(long double f) {
+long double foo3(long double f) {
 #pragma omp target map(f)
   // expected-error at +1 3{{'f' requires 128 bit size 'long double' type support, but device 'nvptx64-unknown-unknown' does not support it}}
   f = 1;


        


More information about the cfe-commits mailing list