[PATCH] D99473: [OCaml] Code simplification using option allocation functions

Josh Berdine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 28 15:31:24 PDT 2021


jberdine created this revision.
jberdine added a reviewer: vaivaswatha.
Herald added a reviewer: whitequark.
jberdine requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Using the `caml_alloc_some` and `ptr_to_option` functions that
allocate OCaml `option` values enables simplifications in many
cases. These simplifications also result in avoiding unnecessary
double initialization in many cases, so yield a minor optimization as
well.

Also, change to avoid using the old unprefixed functions such as
`alloc_small` and instead use the current `caml_alloc_small`.

A few of the changed functions were slightly rewritten in the
early-return style.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99473

Files:
  llvm/bindings/ocaml/llvm/llvm_ocaml.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99473.333740.patch
Type: text/x-patch
Size: 8131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210328/06d2291c/attachment.bin>


More information about the llvm-commits mailing list