Skip to content

Commit 650e736

Browse files
authored
[flang][cuda][NFC] Add some diagnostic when module or fct are not found (#119277)
1 parent 75623bf commit 650e736

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

flang/lib/Optimizer/Dialect/CUF/CUFToLLVMIRTranslation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ LogicalResult registerKernel(cuf::RegisterKernelOp op,
6666
llvm::FunctionType::get(
6767
ptrTy, ArrayRef<llvm::Type *>({ptrTy, ptrTy, ptrTy}), false));
6868
llvm::Value *modulePtr = moduleTranslation.lookupValue(op.getModulePtr());
69+
if (!modulePtr)
70+
return op.emitError() << "Couldn't find the module ptr";
6971
llvm::Function *fctSym =
7072
moduleTranslation.lookupFunction(op.getKernelName().str());
73+
if (!fctSym)
74+
return op.emitError() << "Couldn't find kernel name symbol";
7175
builder.CreateCall(fct, {modulePtr, fctSym,
7276
getOrCreateFunctionName(
7377
module, builder, op.getKernelModuleName().str(),

0 commit comments

Comments
 (0)