Page MenuHomePhabricator

Compute the DISubprogram hash key partially (NFC)
ClosedPublic

Authored by mehdi_amini on Jan 26 2016, 1:23 AM.

Details

Summary

This patch changes the computation of the hash key for DISubprogram to
be computed on a small subset of the fields. The hash is computed a
lot faster, but there might be more collision in the table.
However by carefully selecting the fields, colisions should be rare.

Using opt to load the IR for FastISelEmitter.cpp.o, with this patch:

  • DISubprogram::getImpl() goes from 28ms to 15ms.
  • DICompositeType::getImpl() goes from 6ms to 2ms
  • DIDerivedType::getImpl() goes from 18 to 12ms

Diff Detail

Event Timeline

mehdi_amini retitled this revision from to Compute the DISubprogram hash key partially (NFC).
mehdi_amini updated this object.
mehdi_amini added a reviewer: dexonsmith.
mehdi_amini added a subscriber: llvm-commits.

Applies to other metadata types

I'll let Duncan review this more, but as a quick side note - would you mind
making the ordering of arguments a little more regular? Name, File, Line,
Scope or something?

-eric

mehdi_amini updated this object.

Change the order of arguments as suggested by Eric.

Duncan?

dexonsmith edited edge metadata.Mar 6 2016, 5:31 PM
dexonsmith added a subscriber: dexonsmith.

Sorry, I thought I'd responded back in January. This approach SGTM.

I have some ideas about field choice below. If you've profiled -flto -g
with something non-trivial, then I'm happy for you to commit (LGTM!), but
you might be able to extract even better performance.

mehdi_amini updated this revision to Diff 49938.Mar 7 2016, 1:44 AM
mehdi_amini edited edge metadata.

Update field list: checked an LTO build of llvm-tblgen and made sure there are (almost) no collisions.

mehdi_amini accepted this revision.Mar 18 2016, 6:04 PM
mehdi_amini added a reviewer: mehdi_amini.

(mark as accepted before closing)

This revision is now accepted and ready to land.Mar 18 2016, 6:04 PM