[clang] [CUDA][HIP] Exclude external variables from constant promotion. (PR #73549)

Levon Ter-Grigoryan via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 22:02:53 PST 2023


================
@@ -104,3 +106,14 @@ void fun() {
   (void) b<double>;
   (void) var_host_only;
 }
+
+extern __global__ void external_func();
+extern void* const external_dep[] = {
+  (void*)(external_func)
+};
+extern void* const external_arr[] = {};
+
+void* host_fun() {
+  (void) external_dep;
+  (void) external_arr;
+}
----------------
PatriosTheGreat wrote:

This case is checked by flag "-implicit-check-not=external_" at the line 6, so we can check that external is not mentioned anywhere at the device code.

https://github.com/llvm/llvm-project/pull/73549


More information about the cfe-commits mailing list