This is an archive of the discontinued LLVM Phabricator instance.

Reorder Type fields to make various isa< > check more concise
ClosedPublic

Authored by serge-sans-paille on May 15 2020, 5:02 AM.

Details

Summary

Depending on the order of fields, some isa < > checks can be faster because of
tests that check a range of type, leading to assembly simplification.

To find a relevant ordering, I... brute-forced the permutation among the derived
types and pick the combination that resulted in the smallest libLLVM-11.so.

On my laptop (x86_64), this reduces the size of libLLVM-11.so from 127344064 bytes to 127335336,
that's 8728 bytes shaved without much effort.

Also removed obsolete comments in the process.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
ctetreau accepted this revision.May 15 2020, 11:39 AM

The new ordering seems reasonable to me.

This revision is now accepted and ready to land.May 15 2020, 11:39 AM
ctetreau added inline comments.May 15 2020, 11:48 AM
llvm/include/llvm/IR/Type.h
72–73

comments are stale

ctetreau requested changes to this revision.May 15 2020, 11:48 AM
This revision now requires changes to proceed.May 15 2020, 11:48 AM
ctetreau added inline comments.May 15 2020, 11:49 AM
llvm/include/llvm/IR/Type.h
72–73

You can probably just delete the numbering in the comments.

Remove redundant field info as suggested by @ctetreau

serge-sans-paille marked 2 inline comments as done.May 15 2020, 1:16 PM
ctetreau accepted this revision.May 15 2020, 1:45 PM

looks good to me

This revision is now accepted and ready to land.May 15 2020, 1:45 PM

Thanks for the review!

This revision was automatically updated to reflect the committed changes.