This is an archive of the discontinued LLVM Phabricator instance.

[LiveDebugValues] Speed up collectIDsForRegs, NFC
ClosedPublic

Authored by vsk on Mar 19 2020, 4:59 PM.

Details

Summary

Use the advanceToLowerBound operation available on CoalescingBitVector
iterators to speed up collection of variables which reside within some
set of registers.

The speedup comes from avoiding repeated top-down traversals in
IntervalMap::find. The linear scan forward from one register interval to
the next is unlikely to be as expensive as a full IntervalMap search
starting from the root.

This reduces time spent in LiveDebugValues when compiling sqlite3 by
200ms (about 0.1% - 0.2% of the total User Time).

Depends on D76466.

rdar://60046261

Diff Detail

Event Timeline

vsk created this revision.Mar 19 2020, 4:59 PM
aprantl accepted this revision.Mar 20 2020, 8:54 AM
aprantl added inline comments.
llvm/lib/CodeGen/LiveDebugValues.cpp
801

This looks redundant? No, the formatting in phabricator was weird. this belongs to the outer loop. I guess you could pull this into the inner loop and then get rid of the It != End &&. Not sure if that is a big improvement.

This revision is now accepted and ready to land.Mar 20 2020, 8:54 AM
jmorse accepted this revision.Mar 20 2020, 10:45 AM

LGTM

vsk marked an inline comment as done.Mar 20 2020, 11:49 AM
vsk added inline comments.
llvm/lib/CodeGen/LiveDebugValues.cpp
801

Yeah, this is just trying to return early if there aren't any more IDs to find. It may be at End before we enter the inner loop, so I'm not sure it's safe to sink the check from the loop condition.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2020, 12:29 PM