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

Fix failure in memory order/scope processing at OCL atomic convert pass #57

Open
wants to merge 1 commit into
base: amd-common
Choose a base branch
from
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
6 changes: 4 additions & 2 deletions lib/Target/AMDGPU/AMDGPUConvertAtomicLibCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ static AtomicOrdering MemoryOrderSpir2LLVM(Value *SpirMemOrd) {
memory_order_acq_rel,
memory_order_seq_cst
};
unsigned MemOrd = dyn_cast<ConstantInt>(SpirMemOrd)->getZExtValue();
auto *MO = dyn_cast<ConstantInt>(SpirMemOrd);
unsigned MemOrd = MO ? MO->getZExtValue() : -1;
switch (MemOrd) {
case memory_order_relaxed:
return AtomicOrdering::Monotonic;
Expand All @@ -202,7 +203,8 @@ MemoryScopeOpenCL2LLVM(Value *OpenclMemScope) {
memory_scope_all_svm_devices,
memory_scope_sub_group
};
unsigned MemScope = dyn_cast<ConstantInt>(OpenclMemScope)->getZExtValue();
auto *MS = dyn_cast<ConstantInt>(OpenclMemScope);
unsigned MemScope = MS ? MS->getZExtValue() : -1;
switch (MemScope) {
case memory_scope_work_item:
llvm_unreachable("memory_scope_work_item not Valid for atomic builtins");
Expand Down