Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CUDA] Fix SYCL NVPTX passes if function operand is null-ref #3272

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions llvm/lib/Target/NVPTX/SYCL/GlobalOffset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@ class GlobalOffset : public ModulePass {
continue;

// Get a pointer to the entry point function from the metadata.
auto FuncConstant =
dyn_cast<ConstantAsMetadata>(MetadataNode->getOperand(0));
const auto &FuncOperand = MetadataNode->getOperand(0);
if (!FuncOperand)
continue;
auto FuncConstant = dyn_cast<ConstantAsMetadata>(FuncOperand);
if (!FuncConstant)
continue;
auto Func = dyn_cast<Function>(FuncConstant->getValue());
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/NVPTX/SYCL/LocalAccessorToSharedMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class LocalAccessorToSharedMemory : public ModulePass {

// Get a pointer to the entry point function from the metadata.
const MDOperand &FuncOperand = MetadataNode->getOperand(0);
if (!FuncOperand)
continue;
auto FuncConstant = dyn_cast<ConstantAsMetadata>(FuncOperand);
if (!FuncConstant)
continue;
Expand Down