================
@@ -0,0 +1,25 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -fclangir -std=c++11 -fcuda-is-device -triple
nvptx64-nvidia-cuda -emit-cir -o - %s | FileCheck --check-prefix=DEVICE-CIR %s
+// RUN: %clang_cc1 -fclangir -std=c++11 -fcuda-is-device -triple
nvptx64-nvidia-cuda -emit-llvm -o - %s | FileCheck
--check-prefix=DEVICE-CIR-LLVM %s
+// RUN: %clang_cc1 -std=c++11 -fcuda-is-device -triple nvptx64-nvidia-cuda
-emit-llvm -o - %s | FileCheck --check-prefix=DEVICE-OGCG %s
+
+struct surfaceReference {
+ int desc;
+};
+
+template <typename T, int dim = 1>
+struct __attribute__((device_builtin_surface_type)) surface
+ : public surfaceReference {};
+
+template <int dim>
+struct __attribute__((device_builtin_surface_type)) surface<void, dim>
+ : public surfaceReference {};
+
+surface<void, 2> surf;
+
+// DEVICE-CIR: cir.global external target_address_space(1) @surf = #cir.poison
: !s64i
+
+// CIR lowers poison to LLVM poison, while OG CodeGen emits undef.
----------------
RiverDave wrote:
Yeah, that was intentional. I recall It came from the incubator's push to stop
introducing undef where we don't really need it; see llvm/clangir#1712.
also, afaik, [undef seems to be mostly deprecated at least on LLVM
IR.](https://llvm.org/docs/UndefinedBehavior.html#undef-values) is this a
divergence we can live with?
https://github.com/llvm/llvm-project/pull/196079
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits