Page MenuHomePhabricator

[IRMemoryMap] Shrink Allocation make it move-only (NFC)
ClosedPublic

Authored by vsk on Aug 3 2018, 2:17 PM.

Details

Summary

Profiling data show that Allocation::operator= is hot (see the data
attached to the Phab review).

Reorder a few fields within Allocation to avoid implicit structure
padding and shrink the structure. This should make copies a bit cheaper.

Also, given that an Allocation contains a std::vector (by way of
DataBufferHeap), it's preferable to make it move-only instead of
permitting expensive copies. As an added benefit this allows us to have
a single Allocation constructor instead of two.

Diff Detail

Repository
rL LLVM

Event Timeline

vsk created this revision.Aug 3 2018, 2:17 PM
vsk edited the summary of this revision. (Show Details)Aug 3 2018, 2:39 PM
vsk updated this revision to Diff 159339.Aug 6 2018, 11:15 AM
vsk retitled this revision from [IRMemoryMap] Shrink Allocation by sizeof(addr_t) (NFC) to [IRMemoryMap] Shrink Allocation make it move-only (NFC).
vsk edited the summary of this revision. (Show Details)
  • Make Allocation move-only. This should prevent a std::vector copy in ::Malloc.
vsk added subscribers: lemo, zturner.Aug 6 2018, 12:26 PM
davide accepted this revision.Aug 8 2018, 1:55 PM
davide added a subscriber: davide.

Looks reasonable to me.

This revision is now accepted and ready to land.Aug 8 2018, 1:55 PM
This revision was automatically updated to reflect the committed changes.