[flang-commits] [flang] [flang] Reset all extents to zero for empty hlfir.elemental loops. (PR #124867)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed Jan 29 03:37:19 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.
----------------
tblah wrote:
Which matching do you have in mind? I'm not against (it is easier to read for humans and this isn't too heavy weight), but this isn't the normal way I've seen things work.
I'm not sure how much this helps matching because there is no guarantee there won't already be other zeros in the same function.
https://github.com/llvm/llvm-project/pull/124867
More information about the flang-commits
mailing list