This is an archive of the discontinued LLVM Phabricator instance.

Replace another std::set in the core of CodeGenRegister, this time with sorted arrays.
ClosedPublic

Authored by resistor on Jan 30 2015, 11:59 PM.

Details

Reviewers
chandlerc
Summary

The hot path through this region of code does lots of batch inserts into sets. By storing them as sorted arrays, we can defer the sorting to the end of the batch, which is dramatically more efficient. This reduces tblgen runtime by 25% on my worst-case target.

Diff Detail

Event Timeline

resistor updated this revision to Diff 19086.Jan 30 2015, 11:59 PM
resistor retitled this revision from to Replace another std::set in the core of CodeGenRegister, this time with sorted arrays..
resistor updated this object.
resistor edited the test plan for this revision. (Show Details)
resistor added a reviewer: chandlerc.
resistor set the repository for this revision to rL LLVM.
resistor added a subscriber: Unknown Object (MLST).
chandlerc accepted this revision.Jan 31 2015, 12:12 AM
chandlerc edited edge metadata.

Change looks fine, but I'd really love to see this code cleaned up more if you're going to be here...

  • Not using weird typedefs like Vec
  • Using range based for loops rather than just auto.
  • Use lambdas

Anyways, none of that cleanup should preclude making it go faster.

utils/TableGen/CodeGenRegisters.cpp
645

This should be sortRegisterVector... but it doesn't just sort, it uniques as well. I would probably call it 'sortAndUniqueRegisters', but feel free to paint it a different shade.

utils/TableGen/CodeGenRegisters.h
418–419

My clang format spidey sense says this line break isn't necessary.

This revision is now accepted and ready to land.Jan 31 2015, 12:12 AM
resistor closed this revision.Jan 31 2015, 1:15 AM

r227682