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

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 1 09:59:24 PDT 2021


clementval added inline comments.


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:285
+      subscripts[i - 1] = 0;
+    }
+  }
----------------
mehdi_amini wrote:
> 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).
Right my bad. That's true the function can have some more description without looking how it is used. I'll update that. 


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