[llvm] d459784 - [IR][SPIR-V] Replace of PointerType::get(Type) with opaque version (NFC) (#124755)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 07:44:50 PST 2025
Author: Mats Jun Larsen
Date: 2025-01-28T15:44:45Z
New Revision: d459784cbea334d167b2dca48e0c26115c68e5d3
URL: https://github.com/llvm/llvm-project/commit/d459784cbea334d167b2dca48e0c26115c68e5d3
DIFF: https://github.com/llvm/llvm-project/commit/d459784cbea334d167b2dca48e0c26115c68e5d3.diff
LOG: [IR][SPIR-V] Replace of PointerType::get(Type) with opaque version (NFC) (#124755)
Added:
Modified:
llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index b52c793e57e968..95fa7bc3894fdc 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -2176,14 +2176,8 @@ static SPIRVType *
getOrCreateSPIRVDeviceEventPointer(MachineIRBuilder &MIRBuilder,
SPIRVGlobalRegistry *GR) {
LLVMContext &Context = MIRBuilder.getMF().getFunction().getContext();
- Type *OpaqueType = StructType::getTypeByName(Context, "spirv.DeviceEvent");
- if (!OpaqueType)
- OpaqueType = StructType::getTypeByName(Context, "opencl.clk_event_t");
- if (!OpaqueType)
- OpaqueType = StructType::create(Context, "spirv.DeviceEvent");
- unsigned SC0 = storageClassToAddressSpace(SPIRV::StorageClass::Function);
unsigned SC1 = storageClassToAddressSpace(SPIRV::StorageClass::Generic);
- Type *PtrType = PointerType::get(PointerType::get(OpaqueType, SC0), SC1);
+ Type *PtrType = PointerType::get(Context, SC1);
return GR->getOrCreateSPIRVType(PtrType, MIRBuilder);
}
diff --git a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
index 874894ae987268..e2f1b211caa5c1 100644
--- a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
@@ -629,7 +629,7 @@ SPIRVGlobalRegistry::getOrCreateConstNullPtr(MachineIRBuilder &MIRBuilder,
unsigned AddressSpace = typeToAddressSpace(LLVMTy);
// Find a constant in DT or build a new one.
Constant *CP = ConstantPointerNull::get(
- PointerType::get(::getPointeeType(LLVMTy), AddressSpace));
+ PointerType::get(LLVMTy->getContext(), AddressSpace));
Register Res = DT.find(CP, CurMF);
if (!Res.isValid()) {
LLT LLTy = LLT::pointer(AddressSpace, PointerSize);
More information about the llvm-commits
mailing list