[flang-commits] [flang] [Flang]Add support for inlining hlfir.assign operation where both LHS and RHS are slices of the same array (PR #204532)

via flang-commits flang-commits at lists.llvm.org
Mon Jun 22 02:38:40 PDT 2026


================
@@ -62,6 +62,17 @@ class ArraySectionAnalyzer {
   analyze(mlir::Value ref1, mlir::Value ref2,
           ValueEquivalenceCallback areKnownEquivalent = nullptr);
 
+  ///  Generate a runtime disjointness check for the given LHS and RHS.
+  ///  Check if the sections are disjoint using `ub1 < lb2 || ub2 < lb1`
+  ///  Returns true if the sections are disjoint, false otherwise.
+  ///  Returns nullptr if the operands are not a matching pair of
+  ///  hlfir.designate on the same base or no dimension has statically-known
+  ///  stride order.
+  static mlir::Value genRuntimeDisjointnessCheck(mlir::Location loc,
----------------
jeanPerier wrote:

Please move this into FIRBuilder.h, this header is about static analysis and should not contain API that generates IR.

Prefer using optional<mlir::Value> or FailureOr<mlir::Value> in an API to underline the fact that this will not always succeed.

https://github.com/llvm/llvm-project/pull/204532


More information about the flang-commits mailing list