[PATCH] D13370: [RewriteStatepointsForGC] Cosmetic cleanup, NFC

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 17:31:18 PDT 2015


sanjoy added a comment.

In http://reviews.llvm.org/D13370#260213, @swaroop.sridhar wrote:

> Why is CallSite passed by value?


Passing `CallSite`s by value is really cheap (as cheap as copying a pointer), so there is no benefit in passing them by reference unless the `CallSite` is an out parameter.  The downside of passing them by (non-const) reference is that it is harder to tell if the caller intends to modify the `CallSite` referred to, and passing by `const` reference is more typing. :)

From `CallSite.h`:

  // NOTE: These classes are supposed to have "value semantics". So they should be
  // passed by value, not by reference; they should not be "new"ed or "delete"d.
  // They are efficiently copyable, assignable and constructable, with cost
  // equivalent to copying a pointer (notice that they have only a single data
  // member). The internal representation carries a flag which indicates which of



> Everything else looks good to me. Thanks.


FYI: the updated version has some more (still NFC) cleanup work.


http://reviews.llvm.org/D13370





More information about the llvm-commits mailing list