This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][InstrRef] Improve compile-time performance by handling a single variable at a time
ClosedPublic

Authored by jmorse on Oct 14 2021, 5:48 AM.

Details

Summary

Here's another performance patch for InstrRefBasedLDV: rather than processing all variable values in a scope at a time, instead, process one variable at a time. The benefits are twofold:

  • It's easier to reason about one variable at a time in your mind,
  • This recovers some recent lost performance [0].

I think the performance benefit comes from less work being done: if there are several variables in a lexical scope, and only one of them has a value that changes, then all them get reprocessed. This way we're keeping the locality benefits, but doing less work. Plus, we're dealing with fewer DenseMap lookups.

The downside is that the value-propagation part of variable value calculations is now indented one level further., plus the unit tests all get re-written a bit.

[0] http://llvm-compile-time-tracker.com/compare.php?from=2ce3f528481305be8dd0da344f9f95c41da354ad&to=07fdd77e4557692f3a9ca5a8f4f20a92e36a3b2b&stat=instructions

Diff Detail

Event Timeline

jmorse created this revision.Oct 14 2021, 5:48 AM
jmorse requested review of this revision.Oct 14 2021, 5:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 14 2021, 5:48 AM
Orlando accepted this revision.Oct 15 2021, 8:41 AM

LGTM!

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
2041

Can this no longer be const?

2180

nit: parents -> parent's, while you're nearby.

2438

nit: blocks -> block's

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
638–639

The part of the comment after the colon seems redundant now?

862–863

Doc-comment is out of date.

This revision is now accepted and ready to land.Oct 15 2021, 8:41 AM
jmorse marked 5 inline comments as done.Oct 20 2021, 6:56 AM
jmorse added inline comments.
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
2041

Looks like it can be const, folding that in,

This revision was landed with ongoing or failed builds.Oct 20 2021, 7:04 AM
This revision was automatically updated to reflect the committed changes.
jmorse marked an inline comment as done.