[flang-commits] [flang] [flang][cuda][NFC] Add some diagnostic when module or fct are not found (PR #119277)
via flang-commits
flang-commits at lists.llvm.org
Mon Dec 9 14:03:16 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Valentin Clement (バレンタイン クレメン) (clementval)
<details>
<summary>Changes</summary>
Add some proper error if module or function are not found.
---
Full diff: https://github.com/llvm/llvm-project/pull/119277.diff
1 Files Affected:
- (modified) flang/lib/Optimizer/Dialect/CUF/CUFToLLVMIRTranslation.cpp (+4)
``````````diff
diff --git a/flang/lib/Optimizer/Dialect/CUF/CUFToLLVMIRTranslation.cpp b/flang/lib/Optimizer/Dialect/CUF/CUFToLLVMIRTranslation.cpp
index 63eac46a997718..0c1424d11b515c 100644
--- a/flang/lib/Optimizer/Dialect/CUF/CUFToLLVMIRTranslation.cpp
+++ b/flang/lib/Optimizer/Dialect/CUF/CUFToLLVMIRTranslation.cpp
@@ -66,8 +66,12 @@ LogicalResult registerKernel(cuf::RegisterKernelOp op,
llvm::FunctionType::get(
ptrTy, ArrayRef<llvm::Type *>({ptrTy, ptrTy, ptrTy}), false));
llvm::Value *modulePtr = moduleTranslation.lookupValue(op.getModulePtr());
+ if (!modulePtr)
+ return op.emitError() << "Couldn't find the module ptr";
llvm::Function *fctSym =
moduleTranslation.lookupFunction(op.getKernelName().str());
+ if (!fctSym)
+ return op.emitError() << "Couldn't find kernel name symbol";
builder.CreateCall(fct, {modulePtr, fctSym,
getOrCreateFunctionName(
module, builder, op.getKernelModuleName().str(),
``````````
</details>
https://github.com/llvm/llvm-project/pull/119277
More information about the flang-commits
mailing list