Skip to content

Commit 160d137

Browse files
Let SPIRVWriter translate TypedPointerTypes directly. (#1629)
1 parent 3938c74 commit 160d137

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
#include "llvm/IR/IntrinsicInst.h"
8383
#include "llvm/IR/Module.h"
8484
#include "llvm/IR/Operator.h"
85+
#include "llvm/IR/TypedPointerType.h"
8586
#include "llvm/Pass.h"
8687
#include "llvm/Passes/PassBuilder.h"
8788
#include "llvm/Support/Casting.h"
@@ -342,6 +343,10 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
342343
return transPointerType(ET, AddrSpc);
343344
}
344345

346+
if (auto *TPT = dyn_cast<TypedPointerType>(T)) {
347+
return transPointerType(TPT->getElementType(), TPT->getAddressSpace());
348+
}
349+
345350
if (auto *VecTy = dyn_cast<FixedVectorType>(T)) {
346351
if (VecTy->getElementType()->isPointerTy()) {
347352
// SPV_INTEL_masked_gather_scatter extension changes 2.16.1. Universal

test/event_no_group_cap.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ __kernel void test_fn( const __global char *src)
22
{
33
wait_group_events(0, NULL);
44
}
5-
// RUN: %clang_cc1 -triple spir64 -x cl -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -O0 -emit-llvm-bc %s -o %t.bc -no-opaque-pointers
5+
// RUN: %clang_cc1 -triple spir64 -x cl -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -O0 -emit-llvm-bc %s -o %t.bc
66
// RUN: llvm-spirv %t.bc -spirv-text -o %t.spt
77
// RUN: FileCheck < %t.spt %s
88
// RUN: llvm-spirv %t.bc -o %t.spv

0 commit comments

Comments
 (0)