[PATCH] D115077: [fir] Add array operations documentation

Diana Picus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 00:59:02 PST 2021


rovka added inline comments.


================
Comment at: flang/docs/FIRArrayOperations.md:21
+
+They are currently 6 array operations:
+- `fir.array_load`
----------------
Nit: you might want to rephrase this so we don't have to change the number if we ever have to add or remove one of these.


================
Comment at: flang/docs/FIRArrayOperations.md:65
+shown above. Subsequent changes to the memory containing the array do not
+alter its composite value. This operation let's one load an array as a
+value while applying a runtime shape, shift, or slice to the memory
----------------



================
Comment at: flang/docs/FIRArrayOperations.md:70
+```mlir
+%s = fir.shape_shift %o, %n, %p, %m : (index, index, index, index) -> !fir.shape<2>
+// load the entire array 'a'
----------------



================
Comment at: flang/docs/FIRArrayOperations.md:78
+
+The `array_merge_store` operation store a merged array value to memory. 
+
----------------



================
Comment at: flang/docs/FIRArrayOperations.md:199
+
+One of the main purpose of the array operations present in FIR is to be able to
+perform the dependence analysis and elide copies where possible with a MLIR
----------------



================
Comment at: flang/docs/FIRArrayOperations.md:202
+pass. This pass is called the `array-value-copy` pass.
+The analysis detects if there are any conflicts. A conflicts is when one of the
+following cases occurs:
----------------



================
Comment at: flang/docs/FIRArrayOperations.md:202
+pass. This pass is called the `array-value-copy` pass.
+The analysis detects if there are any conflicts. A conflicts is when one of the
+following cases occurs:
----------------
rovka wrote:
> 
So, IIUC, the 'array-value-copy' is both an analysis pass and a transformation pass, right? I think it would be good to clarify that up front, because I wasn't 100% certain of that until I saw there's a before/after example below. Also explain exactly what the pass does, since it seems to be more than just copy elision, which was what I first understood when I read this text.




================
Comment at: flang/docs/FIRArrayOperations.md:335
+    %14 = arith.subi %13, %c1_3 : index
+    // Move tha value back from the copy to the original array
+    fir.do_loop %arg3 = %c0_2 to %14 step %c1_3 {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115077/new/

https://reviews.llvm.org/D115077



More information about the llvm-commits mailing list