Page MenuHomePhabricator

Move the name pointer off of Value
ClosedPublic

Authored by resistor on Jun 1 2015, 2:59 PM.

Details

Reviewers
chandlerc
pete
Summary

Move the name pointer out of Value into a map that lives on LLVMContext. Production builds of clang do not set names on Value's, so this is wasted space on almost all subclasses of Value. This reduces the size of all Value subclasses by 8 bytes on 64 bit hosts.

The one tricky part of this change is averting compile time regression by keeping Value::hasName() fast. This required stealing bits out of NumOperands.

With this change, peak memory usage on opt -O2 verify-uselistorder-nodbg.lto.bc is decreased by approximately 2.3% (~3MB absolute on my machine).

Diff Detail

Repository
rL LLVM

Event Timeline

resistor updated this revision to Diff 26934.Jun 1 2015, 2:59 PM
resistor retitled this revision from to Move the name pointer off of Value.
resistor updated this object.
resistor edited the test plan for this revision. (Show Details)
resistor added reviewers: pete, chandlerc.
resistor set the repository for this revision to rL LLVM.
resistor updated this object.
resistor added a subscriber: Unknown Object (MLST).
pete accepted this revision.Jun 1 2015, 3:07 PM
pete edited edge metadata.

Nice! LGTM.

This revision is now accepted and ready to land.Jun 1 2015, 3:07 PM
resistor closed this revision.Jun 1 2015, 3:28 PM

r238791

chandlerc edited edge metadata.Jun 1 2015, 4:15 PM

Uh, folks, please discuss this more widely before just committing. This is
a really significant change and has implications you're not really
addressing at all. Clang is not the only frontend and not the only producer
of value names. With this change you'll likely cause a significant compile
time hit for many folks.

Anyone there?

I'm still really unhappy at this going in, I don't think it's necessarily
the right tradeoff at all.

+llvm-commits as well