HomePhabricator

[Attributor][NFC] Encode IRPositions in the bits of a single pointer

Authored by jdoerfert on Apr 17 2020, 4:03 PM.

Description

[Attributor][NFC] Encode IRPositions in the bits of a single pointer

This reduces memory consumption for IRPositions by eliminating the
vtable pointer and the KindOrArgNo integer. Since each abstract
attribute has an associated IRPosition, the 12-16 bytes we save add up
quickly.

No functional change is intended.


Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:

calls to allocation functions: 469545 (260135/s)
temporary memory allocations: 77137 (42735/s)
peak heap memory consumption: 30.50MB
peak RSS (including heaptrack overhead): 119.50MB
total memory leaked: 269.07KB

After:

calls to allocation functions: 468999 (274108/s)
temporary memory allocations: 77002 (45004/s)
peak heap memory consumption: 28.83MB
peak RSS (including heaptrack overhead): 118.05MB
total memory leaked: 269.07KB

Difference:

calls to allocation functions: -546 (5808/s)
temporary memory allocations: -135 (1436/s)
peak heap memory consumption: -1.67MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

CTMark 15 runs

Metric: compile_time

Program lhs rhs diff
test-suite...:: CTMark/sqlite3/sqlite3.test 25.07 24.09 -3.9%
test-suite...Mark/mafft/pairlocalalign.test 14.58 14.14 -3.0%
test-suite...-typeset/consumer-typeset.test 21.78 21.58 -0.9%
test-suite :: CTMark/SPASS/SPASS.test 21.95 22.03 0.4%
test-suite :: CTMark/lencod/lencod.test 25.43 25.50 0.3%
test-suite...ark/tramp3d-v4/tramp3d-v4.test 23.88 23.83 -0.2%
test-suite...TMark/7zip/7zip-benchmark.test 60.24 60.11 -0.2%
test-suite :: CTMark/kimwitu++/kc.test 15.69 15.69 -0.0%
test-suite...:: CTMark/ClamAV/clamscan.test 25.43 25.42 -0.0%
test-suite :: CTMark/Bullet/bullet.test 37.63 37.62 -0.0%
Geomean difference -0.8%


Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D78722