[flang-commits] [flang] [Flang] Get fir::SequenceType from hlfir::ExprType before getShape. (PR #90055)
via flang-commits
flang-commits at lists.llvm.org
Thu Apr 25 07:00:50 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Daniel Chen (DanielCChen)
<details>
<summary>Changes</summary>
This PR is to fix issue #<!-- -->88889 .
Because the type of an actual argument of an array expression of character has type of `hlfir::ExprType`, we need to transform it to `fir::SequenceType` before calling `getBoxTypeWithNewShape`.
Calling `fir::ExprType::getShape` inside of `getBoxTypeWithNewShape` will introduce a circular dependency on FIRDialect and HLFIRDialect libraries.
---
Full diff: https://github.com/llvm/llvm-project/pull/90055.diff
1 Files Affected:
- (modified) flang/lib/Lower/ConvertCall.cpp (+7-3)
``````````diff
diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp
index c6f7d3410ad5cf..32c114865f92c7 100644
--- a/flang/lib/Lower/ConvertCall.cpp
+++ b/flang/lib/Lower/ConvertCall.cpp
@@ -1184,12 +1184,16 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
// actual argument shape information. A descriptor with the dummy shape
// information will be created later when all actual arguments are ready.
mlir::Type dummyTypeWithActualRank = dummyType;
- if (auto baseBoxDummy = mlir::dyn_cast<fir::BaseBoxType>(dummyType))
+ if (auto baseBoxDummy = mlir::dyn_cast<fir::BaseBoxType>(dummyType)) {
if (baseBoxDummy.isAssumedRank() ||
arg.testTKR(Fortran::common::IgnoreTKR::Rank) ||
- arg.isSequenceAssociatedDescriptor())
+ arg.isSequenceAssociatedDescriptor()) {
+ mlir::Type actualTy =
+ hlfir::getFortranElementOrSequenceType(actual.getType());
dummyTypeWithActualRank =
- baseBoxDummy.getBoxTypeWithNewShape(actual.getType());
+ baseBoxDummy.getBoxTypeWithNewShape(actualTy);
+ }
+ }
// Preserve the actual type in the argument preparation in case IgnoreTKR(t)
// is set (descriptors must be created with the actual type in this case, and
// copy-in/copy-out should be driven by the contiguity with regard to the
``````````
</details>
https://github.com/llvm/llvm-project/pull/90055
More information about the flang-commits
mailing list