diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -6561,7 +6561,7 @@ continue; // Analyze declarations. if (const auto *DS = dyn_cast(S)) { - if (llvm::all_of(DS->decls(), [&Ctx](const Decl *D) { + if (llvm::all_of(DS->decls(), [](const Decl *D) { if (isa(D) || isa(D) || isa(D) || isa(D) || isa(D) || isa(D) || @@ -6572,10 +6572,7 @@ const auto *VD = dyn_cast(D); if (!VD) return false; - return VD->isConstexpr() || - ((VD->getType().isTrivialType(Ctx) || - VD->getType()->isReferenceType()) && - (!VD->hasInit() || isTrivial(Ctx, VD->getInit()))); + return VD->hasGlobalStorage() || !VD->isUsed(); })) continue; } diff --git a/clang/test/OpenMP/nvptx_SPMD_codegen.cpp b/clang/test/OpenMP/nvptx_SPMD_codegen.cpp --- a/clang/test/OpenMP/nvptx_SPMD_codegen.cpp +++ b/clang/test/OpenMP/nvptx_SPMD_codegen.cpp @@ -120,10 +120,7 @@ // CHECK-DAG: [[DISTR_LIGHT]] // CHECK-DAG: [[FOR_LIGHT]] // CHECK-DAG: [[LIGHT]] -// CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 0) -// CHECK-DAG: [[DISTR_LIGHT]] -// CHECK-DAG: [[FOR_LIGHT]] -// CHECK-DAG: [[LIGHT]] +// CHECK: call void @__kmpc_kernel_init( // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1) // CHECK-DAG: [[DISTR_FULL]] // CHECK-DAG: [[FULL]]