Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion llvm/lib/SYCLLowerIR/LocalAccessorToSharedMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//===----------------------------------------------------------------------===//

#include "llvm/SYCLLowerIR/LocalAccessorToSharedMemory.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Instructions.h"
Expand Down Expand Up @@ -248,8 +249,12 @@ class LocalAccessorToSharedMemory : public ModulePass {
if (!NvvmMetadata)
return;

// It is possible that the annotations node contains multiple pointers to
// the same metadata, recognise visited ones.
SmallSet<MDNode *, 4> Visited;
for (auto *MetadataNode : NvvmMetadata->operands()) {
if (MetadataNode->getNumOperands() != 3)
Visited.insert(MetadataNode);
if (Visited.contains(MetadataNode) || MetadataNode->getNumOperands() != 3)
continue;

// NVPTX identifies kernel entry points using metadata nodes of the form:
Expand Down