[flang-commits] [flang] [flang] Added hlfir.reshape definition/lowering/codegen. (PR #124226)
via flang-commits
flang-commits at lists.llvm.org
Fri Jan 24 04:53:51 PST 2025
================
@@ -1444,6 +1444,63 @@ void hlfir::CShiftOp::getEffects(
getIntrinsicEffects(getOperation(), effects);
}
+//===----------------------------------------------------------------------===//
+// ReshapeOp
+//===----------------------------------------------------------------------===//
+
+llvm::LogicalResult hlfir::ReshapeOp::verify() {
+ auto results = this->getOperation()->getResultTypes();
+ assert(results.size() == 1);
+ hlfir::ExprType resultType = mlir::cast<hlfir::ExprType>(results[0]);
+ mlir::Value array = this->getArray();
+ auto arrayType = mlir::cast<fir::SequenceType>(
+ hlfir::getFortranElementOrSequenceType(array.getType()));
+ if (hlfir::getFortranElementType(resultType) != arrayType.getElementType())
----------------
jeanPerier wrote:
Same here, character result length dynamic aspect could mismatch with the array type after some FIR transformation that would improve typing after deducing the the length (although in practice we are not doing that, and we may never).
One can also imagine that the result length could also gets its length from PAD if present and static while ARRAY length is not.
https://github.com/llvm/llvm-project/pull/124226
More information about the flang-commits
mailing list