|
16 | 16 |
|
17 | 17 | #include "MCTargetDesc/SPIRVBaseInfo.h"
|
18 | 18 | #include "MCTargetDesc/SPIRVMCTargetDesc.h"
|
| 19 | +#include "SPIRVUtils.h" |
19 | 20 | #include "llvm/ADT/DenseMap.h"
|
20 | 21 | #include "llvm/ADT/MapVector.h"
|
21 | 22 | #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
@@ -285,10 +286,13 @@ class SPIRVGeneralDuplicatesTracker {
|
285 | 286 | TT.add(Ty, MF, R);
|
286 | 287 | }
|
287 | 288 |
|
288 |
| - void add(const Type *PointerElementType, unsigned AddressSpace, |
| 289 | + void add(const Type *PointeeTy, unsigned AddressSpace, |
289 | 290 | const MachineFunction *MF, Register R) {
|
290 |
| - ST.add(SPIRV::PointerTypeDescriptor(PointerElementType, AddressSpace), MF, |
291 |
| - R); |
| 291 | + if (isUntypedPointerTy(PointeeTy)) |
| 292 | + PointeeTy = |
| 293 | + TypedPointerType::get(IntegerType::getInt8Ty(PointeeTy->getContext()), |
| 294 | + getPointerAddressSpace(PointeeTy)); |
| 295 | + ST.add(SPIRV::PointerTypeDescriptor(PointeeTy, AddressSpace), MF, R); |
292 | 296 | }
|
293 | 297 |
|
294 | 298 | void add(const Constant *C, const MachineFunction *MF, Register R) {
|
@@ -320,10 +324,13 @@ class SPIRVGeneralDuplicatesTracker {
|
320 | 324 | return TT.find(const_cast<Type *>(Ty), MF);
|
321 | 325 | }
|
322 | 326 |
|
323 |
| - Register find(const Type *PointerElementType, unsigned AddressSpace, |
| 327 | + Register find(const Type *PointeeTy, unsigned AddressSpace, |
324 | 328 | const MachineFunction *MF) {
|
325 |
| - return ST.find( |
326 |
| - SPIRV::PointerTypeDescriptor(PointerElementType, AddressSpace), MF); |
| 329 | + if (isUntypedPointerTy(PointeeTy)) |
| 330 | + PointeeTy = |
| 331 | + TypedPointerType::get(IntegerType::getInt8Ty(PointeeTy->getContext()), |
| 332 | + getPointerAddressSpace(PointeeTy)); |
| 333 | + return ST.find(SPIRV::PointerTypeDescriptor(PointeeTy, AddressSpace), MF); |
327 | 334 | }
|
328 | 335 |
|
329 | 336 | Register find(const Constant *C, const MachineFunction *MF) {
|
|
0 commit comments