Skip to content

Commit 391a1da

Browse files
bokrzesiigcbot
authored andcommitted
[LLVM 16] Fixing ResolveOCLRaytracingBuiltins by creating "struct.intel_ray_query_opaque_t" that's not present in generated BiF .bc file
When importing built-in types, the type called "struct.intel_ray_query_opaque_t" was properly imported on typed-pointers mode as: ``` %struct.intel_ray_query_opaque_t = type opaque ``` but on opaque types mode it was not present in the generated BiF .bc file, thus it was not imported. It caused ResolveOCLRaytracingBuiltins pass to fail because it relied on having when creating Alloca. ``` auto *allocaType = IGCLLVM::getTypeByName(callInst.getModule(), "struct.intel_ray_query_opaque_t"); auto *alloca = m_builder->CreateAlloca(allocaType); ``` This patch adds workaround for it by creating such type when it is not present.
1 parent ea5c192 commit 391a1da

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

IGC/Compiler/Optimizer/OpenCLPasses/RayTracing/ResolveOCLRaytracingBuiltins.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,14 @@ void ResolveOCLRaytracingBuiltins::defineOpaqueTypes() {
141141
Module *M = m_pCtx->getModule();
142142
LLVMContext &C = M->getContext();
143143

144-
StructType *rayQueryTy = IGCLLVM::getTypeByName(*M, "struct.intel_ray_query_opaque_t");
145-
146-
if (!rayQueryTy)
147-
return;
148-
149144
auto getOrCreateOpaqueType = [](Module *M, const std::string &Name) {
150145
StructType *opaqueType = IGCLLVM::getTypeByName(*M, Name);
151146
if (!opaqueType)
152147
opaqueType = StructType::create(M->getContext(), Name);
153148
return opaqueType;
154149
};
155150

151+
StructType *rayQueryTy = getOrCreateOpaqueType(M, "struct.intel_ray_query_opaque_t");
156152
StructType *rtFenceTy = getOrCreateOpaqueType(M, "struct.rtfence_t");
157153
StructType *rtGlobalsTy = getOrCreateOpaqueType(M, "struct.rtglobals_t");
158154

0 commit comments

Comments
 (0)