[PATCH] D112896: [fir] Add fir.insert_on_range conversion

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 1 09:37:50 PDT 2021


mehdi_amini added inline comments.


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:285
+      subscripts[i - 1] = 0;
+    }
+  }
----------------
clementval wrote:
> mehdi_amini wrote:
> > It is worth documenting that if the subscript is full of zeros then it means we reached the end of the array.
> > This "wrap around" could also be signaled by a returned LogicalResult (or a bool maybe).
> When subscripts is equal to ubounds we reach the end of the array and end of the insertion. 
Right, but I think you're describing a behavior of the caller, while I'm referring to the contract of this function alone.
If we don't expect to wrap-around, then we should just add an assert (and document it). 
(I shouldn't have to analyze call-site(s) to figure out the behavior of a function in isolation).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112896



More information about the llvm-commits mailing list