[flang-commits] [flang] [flang] [parser] fix parsing of cuda_kernel (PR #89613)
via flang-commits
flang-commits at lists.llvm.org
Mon Apr 22 07:58:07 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Iman Hosseini (ImanHosseini)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/89613.diff
2 Files Affected:
- (modified) flang/lib/Optimizer/Dialect/FIROps.cpp (+9-2)
- (modified) flang/test/Lower/CUDA/cuda-kernel-loop-directive.cuf (+1)
``````````diff
diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp
index cc08f29a98f022..83ee243d351c02 100644
--- a/flang/lib/Optimizer/Dialect/FIROps.cpp
+++ b/flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -3904,10 +3904,11 @@ mlir::ParseResult parseCUFKernelValues(
mlir::OpAsmParser &parser,
llvm::SmallVectorImpl<mlir::OpAsmParser::UnresolvedOperand> &values,
llvm::SmallVectorImpl<mlir::Type> &types) {
- if (mlir::succeeded(parser.parseOptionalStar()))
+ if (mlir::succeeded(parser.parseOptionalStar())) {
return mlir::success();
+ }
- if (parser.parseOptionalLParen()) {
+ if (mlir::succeeded(parser.parseOptionalLParen())) {
if (mlir::failed(parser.parseCommaSeparatedList(
mlir::AsmParser::Delimiter::None, [&]() {
if (parser.parseOperand(values.emplace_back()))
@@ -3915,11 +3916,17 @@ mlir::ParseResult parseCUFKernelValues(
return mlir::success();
})))
return mlir::failure();
+ auto builder = parser.getBuilder();
+ for (size_t i = 0; i < values.size(); i++) {
+ types.emplace_back(builder.getType<mlir::IntegerType>(32));
+ }
if (parser.parseRParen())
return mlir::failure();
} else {
if (parser.parseOperand(values.emplace_back()))
return mlir::failure();
+ auto builder = parser.getBuilder();
+ types.emplace_back(builder.getType<mlir::IntegerType>(32));
return mlir::success();
}
return mlir::success();
diff --git a/flang/test/Lower/CUDA/cuda-kernel-loop-directive.cuf b/flang/test/Lower/CUDA/cuda-kernel-loop-directive.cuf
index 6179e609db383c..9b728cd19eb552 100644
--- a/flang/test/Lower/CUDA/cuda-kernel-loop-directive.cuf
+++ b/flang/test/Lower/CUDA/cuda-kernel-loop-directive.cuf
@@ -1,4 +1,5 @@
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
+! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt | FileCheck %s
! Test lowering of CUDA kernel loop directive.
``````````
</details>
https://github.com/llvm/llvm-project/pull/89613
More information about the flang-commits
mailing list