[flang-commits] [flang] [Flang]Add support for inlining hlfir.assign operation where both LHS and RHS are slices of the same array (PR #204532)
Kaviya Rajendiran via flang-commits
flang-commits at lists.llvm.org
Tue Jun 23 09:23:48 PDT 2026
================
@@ -193,6 +194,56 @@ ArraySectionAnalyzer::analyze(mlir::Value ref1, mlir::Value ref2,
return SlicesOverlapKind::Unknown;
}
+mlir::Value ArraySectionAnalyzer::genRuntimeDisjointnessCheck(
+ mlir::Location loc, mlir::OpBuilder &builder, mlir::Value lhsRef,
+ mlir::Value rhsRef) {
----------------
kaviya2510 wrote:
Yes, I implemented a generic address-based check, but applying it in all cases introduces unnecessary overhead, especially when LHS and RHS are sections of the same array with unit stride. In such cases an index-based comparison is more efficient, as it avoids the cost of extracting base addresses, element sizes, extents, and strides at runtime.
So I handled the above scenarios in 2 methods:
- genIndexBasedDisjointnessCheck(..): used when both sides refer to sections of the same array.
- genAddressBasedDisjointnessCheck(..): used as a fallback for complex scenarios.
https://github.com/llvm/llvm-project/pull/204532
More information about the flang-commits
mailing list