[flang-commits] [flang] [flang] Reset all extents to zero for empty hlfir.elemental loops. (PR #124867)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Wed Jan 29 08:43:16 PST 2025
================
@@ -1759,3 +1759,38 @@ fir::factory::deduceOptimalExtents(mlir::ValueRange extents1,
}
return extents;
}
+
+llvm::SmallVector<mlir::Value> fir::factory::updateRuntimeExtentsForEmptyArrays(
+ fir::FirOpBuilder &builder, mlir::Location loc, mlir::ValueRange extents) {
+ if (extents.size() <= 1)
+ return extents;
+
+ // Try to reduce the number of new zero constant operations.
+ // This just makes MLIR matching easier, if CSE is not run
+ // after this.
----------------
vzakhari wrote:
Addressing Jean's question as well.
Yes, it is not usual for extents to have different data types, because they will likely be casted to `index` somewhere else (e.g. as in elemental codegen, where we use `getIndexExtents`).
I guess I overthought it, and I will remove this code :)
https://github.com/llvm/llvm-project/pull/124867
More information about the flang-commits
mailing list