File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
llvm/lib/Target/NVPTX/SYCL Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,15 @@ class GlobalOffset : public ModulePass {
320
320
auto NvvmMetadata = M.getNamedMetadata (" nvvm.annotations" );
321
321
assert (NvvmMetadata && " IR compiled to PTX must have nvvm.annotations" );
322
322
323
+ SmallPtrSet<GlobalValue *, 8u > Used;
324
+ collectUsedGlobalVariables (M, Used, /* CompilerUsed=*/ false );
325
+ collectUsedGlobalVariables (M, Used, /* CompilerUsed=*/ true );
326
+ auto HasUseOtherThanLLVMUsed = [&Used](GlobalValue *GV) {
327
+ if (GV->use_empty ())
328
+ return false ;
329
+ return !GV->hasOneUse () || !Used.count (GV);
330
+ };
331
+
323
332
llvm::DenseMap<Function *, MDNode *> NvvmEntryPointMetadata;
324
333
for (auto MetadataNode : NvvmMetadata->operands ()) {
325
334
if (MetadataNode->getNumOperands () != 3 )
@@ -341,7 +350,7 @@ class GlobalOffset : public ModulePass {
341
350
if (!Func)
342
351
continue ;
343
352
344
- assert (Func-> use_empty ( ) && " Kernel entry point with uses" );
353
+ assert (! HasUseOtherThanLLVMUsed (Func ) && " Kernel entry point with uses" );
345
354
NvvmEntryPointMetadata[Func] = MetadataNode;
346
355
}
347
356
return NvvmEntryPointMetadata;
You can’t perform that action at this time.
0 commit comments