[flang-commits] [flang] [flang][MIF] Fix COSHAPE and THIS_IMAGE(coarray) type mismatch for non-i64 kinds (PR #208429)
via flang-commits
flang-commits at lists.llvm.org
Thu Jul 9 04:20:38 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- flang/lib/Optimizer/Builder/IntrinsicCall.cpp flang/lib/Optimizer/Transforms/MIFOpConversion.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp b/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp
index edecf02c0..1ceac4278 100644
--- a/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp
@@ -425,11 +425,10 @@ struct MIFInitOpConversion : public mlir::OpRewritePattern<mif::InitOp> {
/// otherwise allocates a typed buffer, copies with element-wise conversion,
/// and returns the result widened to \p declaredBoxTy.
static mlir::Value convertI64SeqToEleTy(fir::FirOpBuilder &builder,
- mlir::Location loc,
- mlir::Value i64Result,
- mlir::Type i64Ty, mlir::Type eleTy,
- std::int64_t corank,
- mlir::Type declaredBoxTy) {
+ mlir::Location loc,
+ mlir::Value i64Result, mlir::Type i64Ty,
+ mlir::Type eleTy, std::int64_t corank,
+ mlir::Type declaredBoxTy) {
if (eleTy == i64Ty)
return i64Result;
mlir::Value i64Buf = fir::BoxAddrOp::create(
@@ -437,9 +436,8 @@ static mlir::Value convertI64SeqToEleTy(fir::FirOpBuilder &builder,
builder.getRefType(
mlir::cast<fir::BoxType>(i64Result.getType()).getEleTy()),
i64Result);
- mlir::Type declaredSeqType =
- fir::SequenceType::get(static_cast<fir::SequenceType::Extent>(corank),
- eleTy);
+ mlir::Type declaredSeqType = fir::SequenceType::get(
+ static_cast<fir::SequenceType::Extent>(corank), eleTy);
mlir::Value declaredBuf = builder.createTemporary(loc, declaredSeqType);
mlir::Type indexTy = builder.getIndexType();
mlir::Type i64RefTy = builder.getRefType(i64Ty);
@@ -523,7 +521,7 @@ struct MIFThisImageOpConversion
auto boxResultTy = mlir::cast<fir::BoxType>(op.getResult().getType());
mlir::Type eleTy = fir::unwrapSequenceType(boxResultTy.getEleTy());
result = convertI64SeqToEleTy(builder, loc, result, i64Ty, eleTy,
- corank, op.getResult().getType());
+ corank, op.getResult().getType());
}
rewriter.replaceOp(op, result);
} else {
@@ -1237,7 +1235,7 @@ struct MIFCoshapeOpConversion : public mlir::OpRewritePattern<mif::CoshapeOp> {
auto boxResultTy = mlir::cast<fir::BoxType>(op.getResult().getType());
mlir::Type eleTy = fir::unwrapSequenceType(boxResultTy.getEleTy());
result = convertI64SeqToEleTy(builder, loc, result, i64Ty, eleTy, corank,
- op.getResult().getType());
+ op.getResult().getType());
rewriter.replaceOp(op, result);
return mlir::success();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/208429
More information about the flang-commits
mailing list