Skip to content

Commit d459784

Browse files
authored
[IR][SPIR-V] Replace of PointerType::get(Type) with opaque version (NFC) (#124755)
1 parent a0b0490 commit d459784

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,14 +2176,8 @@ static SPIRVType *
21762176
getOrCreateSPIRVDeviceEventPointer(MachineIRBuilder &MIRBuilder,
21772177
SPIRVGlobalRegistry *GR) {
21782178
LLVMContext &Context = MIRBuilder.getMF().getFunction().getContext();
2179-
Type *OpaqueType = StructType::getTypeByName(Context, "spirv.DeviceEvent");
2180-
if (!OpaqueType)
2181-
OpaqueType = StructType::getTypeByName(Context, "opencl.clk_event_t");
2182-
if (!OpaqueType)
2183-
OpaqueType = StructType::create(Context, "spirv.DeviceEvent");
2184-
unsigned SC0 = storageClassToAddressSpace(SPIRV::StorageClass::Function);
21852179
unsigned SC1 = storageClassToAddressSpace(SPIRV::StorageClass::Generic);
2186-
Type *PtrType = PointerType::get(PointerType::get(OpaqueType, SC0), SC1);
2180+
Type *PtrType = PointerType::get(Context, SC1);
21872181
return GR->getOrCreateSPIRVType(PtrType, MIRBuilder);
21882182
}
21892183

llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ SPIRVGlobalRegistry::getOrCreateConstNullPtr(MachineIRBuilder &MIRBuilder,
629629
unsigned AddressSpace = typeToAddressSpace(LLVMTy);
630630
// Find a constant in DT or build a new one.
631631
Constant *CP = ConstantPointerNull::get(
632-
PointerType::get(::getPointeeType(LLVMTy), AddressSpace));
632+
PointerType::get(LLVMTy->getContext(), AddressSpace));
633633
Register Res = DT.find(CP, CurMF);
634634
if (!Res.isValid()) {
635635
LLT LLTy = LLT::pointer(AddressSpace, PointerSize);

0 commit comments

Comments
 (0)