Skip to content
Open
Changes from all commits
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
8 changes: 5 additions & 3 deletions llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ PropSetRegTy computeModuleProperties(const Module &M,
if (!GV.hasExternalLinkage())
continue;

auto *ST = dyn_cast<StructType>(GV.getValueType());
if (!ST || ST->isLiteral()) // Literal structs don't have names.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead would calling hasName() work? just in case there is another case there is no name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1.
Also I would update the comment to: // Only named structs carry the device_global type name.

continue;

// Check if it's a device_global by type name (declarations don't have
// attributes).
std::string TypeName;
raw_string_ostream(TypeName) << *GV.getValueType();

StringRef TypeName = ST->getStructName();
if (TypeName.find("device_global") == std::string::npos)
continue;

Expand Down
Loading